Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11ab3a4f6b | ||
|
|
0ba57b26d1 | ||
|
|
36c2389985 | ||
|
|
93d5041e8f | ||
|
|
f4d933936e | ||
|
|
2cdaf71c4b | ||
|
|
6982380aff | ||
|
|
2cc2c4d415 | ||
|
|
da38e0f890 | ||
|
|
c7c1723914 | ||
|
|
15e85bf4b9 | ||
|
|
e7771b02a4 |
@@ -13,6 +13,7 @@ jobs:
|
||||
CI_LOG: 123
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn build
|
||||
yarn networks:crosscheck
|
||||
|
||||
- name: issue
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 7.6.1 Oct 23, 2021
|
||||
|
||||
Changes:
|
||||
|
||||
- Update `xxhash*` to only use `Uint8Array` internally, no `Buffer`
|
||||
- Adjust `isAscii` to check against original string codepoints (when provided)
|
||||
- Adjust networks to sync with `paritytech/ss58-registry`
|
||||
- Dedupe internal sr25519/ed25519 derivation functions
|
||||
- Bump Ledger libraries to latest versions
|
||||
|
||||
|
||||
## 7.5.1 Oct 16, 2021
|
||||
|
||||
Contributed:
|
||||
@@ -23,6 +34,7 @@ Changes:
|
||||
- Adjust `isHex` return to `0x${string}` under TypeScript
|
||||
- Adjust shared repo Jest config
|
||||
- Sync with upstream Substrate ss58 registry
|
||||
- Cleanup rollup build where `x-global` yields undefined
|
||||
|
||||
|
||||
## 7.3.1 Aug 28, 2021
|
||||
|
||||
+3
-3
@@ -24,11 +24,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.8",
|
||||
"@polkadot/dev": "^0.62.71",
|
||||
"@polkadot/ts": "^0.4.9",
|
||||
"@polkadot/dev": "^0.63.6",
|
||||
"@polkadot/ts": "^0.4.10",
|
||||
"@types/ed2curve": "^0.2.2",
|
||||
"@types/jest": "^27.0.2"
|
||||
},
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"packageManager": "yarn@3.0.1"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/hw-ledger-transports",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"repository": "github:polkadot-js/common",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@@ -16,11 +16,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@ledgerhq/hw-transport": "^6.7.0",
|
||||
"@ledgerhq/hw-transport-webhid": "^6.7.0",
|
||||
"@ledgerhq/hw-transport-webusb": "^6.7.0"
|
||||
"@ledgerhq/hw-transport": "^6.11.0",
|
||||
"@ledgerhq/hw-transport-webhid": "^6.11.0",
|
||||
"@ledgerhq/hw-transport-webusb": "^6.11.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@ledgerhq/hw-transport-node-hid-singleton": "^6.7.0"
|
||||
"@ledgerhq/hw-transport-node-hid-singleton": "^6.11.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/hw-ledger-transports', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/hw-ledger-transports', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/hw-ledger",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"repository": "github:polkadot-js/common",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@@ -17,8 +17,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/hw-ledger-transports": "7.5.1",
|
||||
"@polkadot/util": "7.5.1",
|
||||
"@polkadot/hw-ledger-transports": "7.6.1",
|
||||
"@polkadot/util": "7.6.1",
|
||||
"@zondax/ledger-substrate": "^0.18.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/hw-ledger', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/hw-ledger', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/keyring",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "Keyring management",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
@@ -20,11 +20,11 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/util": "7.5.1",
|
||||
"@polkadot/util-crypto": "7.5.1"
|
||||
"@polkadot/util": "7.6.1",
|
||||
"@polkadot/util-crypto": "7.6.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "7.5.1",
|
||||
"@polkadot/util-crypto": "7.5.1"
|
||||
"@polkadot/util": "7.6.1",
|
||||
"@polkadot/util-crypto": "7.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ describe('keypair', (): void => {
|
||||
it('allows adding from JSON', (): void => {
|
||||
expect(
|
||||
keyring.addFromJson(
|
||||
JSON.parse('{"address":"5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua","encoded":"0xb4a14995d25ab609f3686e9fa45f1fb237cd833f33f00d4b12c51858ca070d96972e47d73aae5eeb0fc06f923826cf0943fdb02c2c2ee30ef52a7912663053940d1da4da66b3a3f520ae07422c1c94b2d95690fca9d1f4a997623bb2923a8833280e19e7f72c3c5cfa343974e60e2b3dc53b404fdaf330756daad5e4e3","encoding":{"content":"pkcs8","type":"xsalsa20-poly1305","version":"0"},"meta":{"isTesting":true,"name":"alice"}}')
|
||||
JSON.parse('{"address":"5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua","encoded":"0xb4a14995d25ab609f3686e9fa45f1fb237cd833f33f00d4b12c51858ca070d96972e47d73aae5eeb0fc06f923826cf0943fdb02c2c2ee30ef52a7912663053940d1da4da66b3a3f520ae07422c1c94b2d95690fca9d1f4a997623bb2923a8833280e19e7f72c3c5cfa343974e60e2b3dc53b404fdaf330756daad5e4e3","encoding":{"content":"pkcs8","type":"xsalsa20-poly1305","version":"0"},"meta":{"isTesting":true,"name":"alice"}}') as KeyringPair$Json
|
||||
).publicKey
|
||||
).toEqual(
|
||||
new Uint8Array([209, 114, 167, 76, 218, 76, 134, 89, 18, 195, 43, 160, 168, 10, 87, 174, 105, 171, 174, 65, 14, 92, 203, 89, 222, 232, 78, 47, 68, 50, 219, 79])
|
||||
@@ -172,7 +172,7 @@ describe('keypair', (): void => {
|
||||
it('allows adding from JSON', (): void => {
|
||||
expect(
|
||||
keyring.addFromJson(
|
||||
JSON.parse('{"address":"5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua","encoded":"0xb4a14995d25ab609f3686e9fa45f1fb237cd833f33f00d4b12c51858ca070d96972e47d73aae5eeb0fc06f923826cf0943fdb02c2c2ee30ef52a7912663053940d1da4da66b3a3f520ae07422c1c94b2d95690fca9d1f4a997623bb2923a8833280e19e7f72c3c5cfa343974e60e2b3dc53b404fdaf330756daad5e4e3","encoding":{"content":"pkcs8","type":"xsalsa20-poly1305","version":"0"},"meta":{"isTesting":true,"name":"alice"}}')
|
||||
JSON.parse('{"address":"5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaQua","encoded":"0xb4a14995d25ab609f3686e9fa45f1fb237cd833f33f00d4b12c51858ca070d96972e47d73aae5eeb0fc06f923826cf0943fdb02c2c2ee30ef52a7912663053940d1da4da66b3a3f520ae07422c1c94b2d95690fca9d1f4a997623bb2923a8833280e19e7f72c3c5cfa343974e60e2b3dc53b404fdaf330756daad5e4e3","encoding":{"content":"pkcs8","type":"xsalsa20-poly1305","version":"0"},"meta":{"isTesting":true,"name":"alice"}}') as KeyringPair$Json
|
||||
).publicKey
|
||||
).toEqual(
|
||||
new Uint8Array([209, 114, 167, 76, 218, 76, 134, 89, 18, 195, 43, 160, 168, 10, 87, 174, 105, 171, 174, 65, 14, 92, 203, 89, 222, 232, 78, 47, 68, 50, 219, 79])
|
||||
@@ -251,7 +251,7 @@ describe('keypair', (): void => {
|
||||
it('allows adding from JSON', (): void => {
|
||||
expect(
|
||||
keyring.addFromJson(
|
||||
JSON.parse('{"address":"5DzMsaYFhmpRdErWrP6K6PD7UXzYoeETToSBUrZSvxasqWRz","encoded":"0xa192d39b42bc1601bf61df31039a554228593fadf870bc837b658a5114627aca199fff596260c95fe8994c66a47636cf0270aa08f402ba5541038753960d00e6c3af5e239ec58fb1eef3db7d6bc266f4853bdfe4ed17122d9092d879014d53980d2ee57f6f55a88c38836447d8645008e8815379626addc8f81f80cd49a2","encoding":{"content":"pkcs8","type":"xsalsa20-poly1305","version":"2"},"meta":{}}')
|
||||
JSON.parse('{"address":"5DzMsaYFhmpRdErWrP6K6PD7UXzYoeETToSBUrZSvxasqWRz","encoded":"0xa192d39b42bc1601bf61df31039a554228593fadf870bc837b658a5114627aca199fff596260c95fe8994c66a47636cf0270aa08f402ba5541038753960d00e6c3af5e239ec58fb1eef3db7d6bc266f4853bdfe4ed17122d9092d879014d53980d2ee57f6f55a88c38836447d8645008e8815379626addc8f81f80cd49a2","encoding":{"content":"pkcs8","type":"xsalsa20-poly1305","version":"2"},"meta":{}}') as KeyringPair$Json
|
||||
).address
|
||||
).toEqual('5DzMsaYFhmpRdErWrP6K6PD7UXzYoeETToSBUrZSvxasqWRz');
|
||||
});
|
||||
@@ -259,7 +259,7 @@ describe('keypair', (): void => {
|
||||
it('allows creation from JSON', (): void => {
|
||||
keyring.setSS58Format(2);
|
||||
const pair = keyring.createFromJson(
|
||||
JSON.parse('{"address":"0x02fde629668eb2bcc7d748f40a7e597f7c7b363498ff3db31f03ce4854937883ad","encoded":"qIhAhKqtf2iyEoWEr8nmBdksSI8EHHCpgJHToqd6Pl8AgAAAAQAAAAgAAADDZ//fj/BRRj+0+bl1KAlYgoPJp6nEUwiw0fVqO2BW4mjEgQ+iWwJEgDf1JUtecbzOlfhTXBzqX/dIYzLgUADrF4EFEPpboCWiU1iN7W/3DM1cOTRVvTGcbdIqW//z3axhz961qzeJVUIFgllwGe/euLUPIlKbIkiN/CsRYdQ=","encoding":{"content":["pkcs8","ecdsa"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{"genesisHash":"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","name":"ecdsa","tags":[],"whenCreated":1600925898271}}')
|
||||
JSON.parse('{"address":"0x02fde629668eb2bcc7d748f40a7e597f7c7b363498ff3db31f03ce4854937883ad","encoded":"qIhAhKqtf2iyEoWEr8nmBdksSI8EHHCpgJHToqd6Pl8AgAAAAQAAAAgAAADDZ//fj/BRRj+0+bl1KAlYgoPJp6nEUwiw0fVqO2BW4mjEgQ+iWwJEgDf1JUtecbzOlfhTXBzqX/dIYzLgUADrF4EFEPpboCWiU1iN7W/3DM1cOTRVvTGcbdIqW//z3axhz961qzeJVUIFgllwGe/euLUPIlKbIkiN/CsRYdQ=","encoding":{"content":["pkcs8","ecdsa"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{"genesisHash":"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","name":"ecdsa","tags":[],"whenCreated":1600925898271}}') as KeyringPair$Json
|
||||
);
|
||||
|
||||
expect(pair.address).toEqual('DHL8HKFuTTR55JzzLmkJRCAfPBbuevKaT9cXikxbEV97Ko8');
|
||||
@@ -268,7 +268,7 @@ describe('keypair', (): void => {
|
||||
|
||||
it('fails toJson() when password is incorrect', (): void => {
|
||||
const pair = keyring.createFromJson(
|
||||
JSON.parse('{"address":"0x02fde629668eb2bcc7d748f40a7e597f7c7b363498ff3db31f03ce4854937883ad","encoded":"qIhAhKqtf2iyEoWEr8nmBdksSI8EHHCpgJHToqd6Pl8AgAAAAQAAAAgAAADDZ//fj/BRRj+0+bl1KAlYgoPJp6nEUwiw0fVqO2BW4mjEgQ+iWwJEgDf1JUtecbzOlfhTXBzqX/dIYzLgUADrF4EFEPpboCWiU1iN7W/3DM1cOTRVvTGcbdIqW//z3axhz961qzeJVUIFgllwGe/euLUPIlKbIkiN/CsRYdQ=","encoding":{"content":["pkcs8","ecdsa"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{"genesisHash":"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","name":"ecdsa","tags":[],"whenCreated":1600925898271}}')
|
||||
JSON.parse('{"address":"0x02fde629668eb2bcc7d748f40a7e597f7c7b363498ff3db31f03ce4854937883ad","encoded":"qIhAhKqtf2iyEoWEr8nmBdksSI8EHHCpgJHToqd6Pl8AgAAAAQAAAAgAAADDZ//fj/BRRj+0+bl1KAlYgoPJp6nEUwiw0fVqO2BW4mjEgQ+iWwJEgDf1JUtecbzOlfhTXBzqX/dIYzLgUADrF4EFEPpboCWiU1iN7W/3DM1cOTRVvTGcbdIqW//z3axhz961qzeJVUIFgllwGe/euLUPIlKbIkiN/CsRYdQ=","encoding":{"content":["pkcs8","ecdsa"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{"genesisHash":"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","name":"ecdsa","tags":[],"whenCreated":1600925898271}}') as KeyringPair$Json
|
||||
);
|
||||
|
||||
expect(
|
||||
@@ -278,7 +278,7 @@ describe('keypair', (): void => {
|
||||
|
||||
it('pass toJson() when password is correct', (): void => {
|
||||
const pair = keyring.createFromJson(
|
||||
JSON.parse('{"address":"0x02fde629668eb2bcc7d748f40a7e597f7c7b363498ff3db31f03ce4854937883ad","encoded":"qIhAhKqtf2iyEoWEr8nmBdksSI8EHHCpgJHToqd6Pl8AgAAAAQAAAAgAAADDZ//fj/BRRj+0+bl1KAlYgoPJp6nEUwiw0fVqO2BW4mjEgQ+iWwJEgDf1JUtecbzOlfhTXBzqX/dIYzLgUADrF4EFEPpboCWiU1iN7W/3DM1cOTRVvTGcbdIqW//z3axhz961qzeJVUIFgllwGe/euLUPIlKbIkiN/CsRYdQ=","encoding":{"content":["pkcs8","ecdsa"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{"genesisHash":"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","name":"ecdsa","tags":[],"whenCreated":1600925898271}}')
|
||||
JSON.parse('{"address":"0x02fde629668eb2bcc7d748f40a7e597f7c7b363498ff3db31f03ce4854937883ad","encoded":"qIhAhKqtf2iyEoWEr8nmBdksSI8EHHCpgJHToqd6Pl8AgAAAAQAAAAgAAADDZ//fj/BRRj+0+bl1KAlYgoPJp6nEUwiw0fVqO2BW4mjEgQ+iWwJEgDf1JUtecbzOlfhTXBzqX/dIYzLgUADrF4EFEPpboCWiU1iN7W/3DM1cOTRVvTGcbdIqW//z3axhz961qzeJVUIFgllwGe/euLUPIlKbIkiN/CsRYdQ=","encoding":{"content":["pkcs8","ecdsa"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{"genesisHash":"0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe","name":"ecdsa","tags":[],"whenCreated":1600925898271}}') as KeyringPair$Json
|
||||
);
|
||||
|
||||
expect(
|
||||
@@ -405,7 +405,7 @@ describe('keypair', (): void => {
|
||||
|
||||
it('allows adding from JSON', (): void => {
|
||||
const pair = keyring.addFromJson(
|
||||
JSON.parse('{"address":"KWCv1L3QX9LDPwY4VzvLmarEmXjVJidUzZcinvVnmxAJJCBou","encoded":"U8qFEaghhmNV2PgFhjqzmhyUy37Ok7abfFU2MNsBd0sAgAAAAQAAAAgAAAA3+NniKogzNphiMNueB1X0sGA07B6CaXWfpXPx45iSXoTTprwzU5mOoSqUWO0GKHROI72LN+uJ8Yfv6Ll6JOOV3VPKfoVoFmYm+zDrrMPa0gk5E5kUuSijxADcE6zUrliPVr0Ix/qaghu5SJ7RtWDQLBf4Hp86SJ8Gg6gTSSk=","encoding":{"content":["pkcs8","ethereum"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{}}')
|
||||
JSON.parse('{"address":"KWCv1L3QX9LDPwY4VzvLmarEmXjVJidUzZcinvVnmxAJJCBou","encoded":"U8qFEaghhmNV2PgFhjqzmhyUy37Ok7abfFU2MNsBd0sAgAAAAQAAAAgAAAA3+NniKogzNphiMNueB1X0sGA07B6CaXWfpXPx45iSXoTTprwzU5mOoSqUWO0GKHROI72LN+uJ8Yfv6Ll6JOOV3VPKfoVoFmYm+zDrrMPa0gk5E5kUuSijxADcE6zUrliPVr0Ix/qaghu5SJ7RtWDQLBf4Hp86SJ8Gg6gTSSk=","encoding":{"content":["pkcs8","ethereum"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{}}') as KeyringPair$Json
|
||||
);
|
||||
|
||||
expect(pair.publicKey).toEqual(hexToU8a('0x03b9dc646dd71118e5f7fda681ad9eca36eb3ee96f344f582fbe7b5bcdebb13077'));
|
||||
@@ -422,7 +422,7 @@ describe('keypair', (): void => {
|
||||
const MESSAGE = stringToU8a('just some test message');
|
||||
const signer = keyring.createFromUri(PHRASE);
|
||||
const verifier = keyring.addFromJson(
|
||||
JSON.parse('{"address":"KWCv1L3QX9LDPwY4VzvLmarEmXjVJidUzZcinvVnmxAJJCBou","encoded":"U8qFEaghhmNV2PgFhjqzmhyUy37Ok7abfFU2MNsBd0sAgAAAAQAAAAgAAAA3+NniKogzNphiMNueB1X0sGA07B6CaXWfpXPx45iSXoTTprwzU5mOoSqUWO0GKHROI72LN+uJ8Yfv6Ll6JOOV3VPKfoVoFmYm+zDrrMPa0gk5E5kUuSijxADcE6zUrliPVr0Ix/qaghu5SJ7RtWDQLBf4Hp86SJ8Gg6gTSSk=","encoding":{"content":["pkcs8","ethereum"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{}}')
|
||||
JSON.parse('{"address":"KWCv1L3QX9LDPwY4VzvLmarEmXjVJidUzZcinvVnmxAJJCBou","encoded":"U8qFEaghhmNV2PgFhjqzmhyUy37Ok7abfFU2MNsBd0sAgAAAAQAAAAgAAAA3+NniKogzNphiMNueB1X0sGA07B6CaXWfpXPx45iSXoTTprwzU5mOoSqUWO0GKHROI72LN+uJ8Yfv6Ll6JOOV3VPKfoVoFmYm+zDrrMPa0gk5E5kUuSijxADcE6zUrliPVr0Ix/qaghu5SJ7RtWDQLBf4Hp86SJ8Gg6gTSSk=","encoding":{"content":["pkcs8","ethereum"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{}}') as KeyringPair$Json
|
||||
);
|
||||
|
||||
const signature = signer.sign(MESSAGE);
|
||||
@@ -439,7 +439,7 @@ describe('keypair', (): void => {
|
||||
const MESSAGE = stringToU8a('just some test message');
|
||||
const signer = keyring.createFromUri(PHRASE);
|
||||
const verifier = keyring.addFromJson(
|
||||
JSON.parse('{"address":"KWCv1L3QX9LDPwY4VzvLmarEmXjVJidUzZcinvVnmxAJJCBou","encoded":"U8qFEaghhmNV2PgFhjqzmhyUy37Ok7abfFU2MNsBd0sAgAAAAQAAAAgAAAA3+NniKogzNphiMNueB1X0sGA07B6CaXWfpXPx45iSXoTTprwzU5mOoSqUWO0GKHROI72LN+uJ8Yfv6Ll6JOOV3VPKfoVoFmYm+zDrrMPa0gk5E5kUuSijxADcE6zUrliPVr0Ix/qaghu5SJ7RtWDQLBf4Hp86SJ8Gg6gTSSk=","encoding":{"content":["pkcs8","ethereum"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{}}')
|
||||
JSON.parse('{"address":"KWCv1L3QX9LDPwY4VzvLmarEmXjVJidUzZcinvVnmxAJJCBou","encoded":"U8qFEaghhmNV2PgFhjqzmhyUy37Ok7abfFU2MNsBd0sAgAAAAQAAAAgAAAA3+NniKogzNphiMNueB1X0sGA07B6CaXWfpXPx45iSXoTTprwzU5mOoSqUWO0GKHROI72LN+uJ8Yfv6Ll6JOOV3VPKfoVoFmYm+zDrrMPa0gk5E5kUuSijxADcE6zUrliPVr0Ix/qaghu5SJ7RtWDQLBf4Hp86SJ8Gg6gTSSk=","encoding":{"content":["pkcs8","ethereum"],"type":["scrypt","xsalsa20-poly1305"],"version":"3"},"meta":{}}') as KeyringPair$Json
|
||||
);
|
||||
|
||||
const signature = signer.sign(MESSAGE, { withType: true });
|
||||
@@ -508,7 +508,7 @@ describe('keypair', (): void => {
|
||||
});
|
||||
|
||||
it('can decode from a version 2 JSON file', (): void => {
|
||||
const pair = keyring.addFromJson(JSON.parse(PAIR));
|
||||
const pair = keyring.addFromJson(JSON.parse(PAIR) as KeyringPair$Json);
|
||||
|
||||
pair.decodePkcs8(PASS2);
|
||||
|
||||
@@ -538,7 +538,7 @@ describe('keypair', (): void => {
|
||||
});
|
||||
|
||||
it('can decode from a version 3 JSON file', (): void => {
|
||||
const pair = keyring.addFromJson(JSON.parse(PAIR));
|
||||
const pair = keyring.addFromJson(JSON.parse(PAIR) as KeyringPair$Json);
|
||||
|
||||
pair.decodePkcs8(PASS3);
|
||||
|
||||
@@ -557,7 +557,7 @@ describe('keypair', (): void => {
|
||||
});
|
||||
|
||||
it('can decode from a version 3 JSON file', (): void => {
|
||||
const pair = keyring.addFromJson(JSON.parse(PAIR));
|
||||
const pair = keyring.addFromJson(JSON.parse(PAIR) as KeyringPair$Json);
|
||||
|
||||
pair.decodePkcs8(PASS3);
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ export class Keyring implements KeyringInstance {
|
||||
return this.type === 'ethereum'
|
||||
? ethereumEncode(address)
|
||||
: encodeAddress(address, isUndefined(ss58Format) ? this.#ss58 : ss58Format);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @name getPair
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/keyring', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/keyring', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/networks",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A list of all available Substrate networks and their applicable prefixes",
|
||||
"main": "index.js",
|
||||
@@ -19,7 +19,7 @@
|
||||
"@babel/runtime": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/util": "7.5.1",
|
||||
"@polkadot/x-fetch": "7.5.1"
|
||||
"@polkadot/util": "7.6.1",
|
||||
"@polkadot/x-fetch": "7.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
import fs from 'fs';
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
const SUBSTRATE_REGISTRY = 'https://raw.githubusercontent.com/paritytech/substrate/master/ss58-registry.json';
|
||||
import { substrateRegistry } from '../build/defaults.js';
|
||||
|
||||
const substrateRegistryRepo = substrateRegistry
|
||||
.replace('raw.githubusercontent.com', 'github.com')
|
||||
.split('main')[0];
|
||||
|
||||
function outputField (k, v) {
|
||||
if (typeof v === 'string') {
|
||||
@@ -20,7 +24,7 @@ function outputField (k, v) {
|
||||
}
|
||||
|
||||
async function getSubstrateRegistry () {
|
||||
const original = await fetch(SUBSTRATE_REGISTRY);
|
||||
const original = await fetch(substrateRegistry);
|
||||
const json = await original.json();
|
||||
|
||||
return json.registry
|
||||
@@ -39,11 +43,17 @@ getSubstrateRegistry()
|
||||
fs.writeFileSync('packages/networks/src/substrate.ts', `// Copyright 2017-2021 @polkadot/networks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//
|
||||
// Auto-generated by yarn networks:sync (via scripts/fromSubstrate.mjs)
|
||||
//
|
||||
// Do not edit, rather
|
||||
// - make a PR to the upstream registry as per ${SUBSTRATE_REGISTRY}
|
||||
// - yarn networks:sync
|
||||
// This file should never be edited manually. Rather the process is as follow -
|
||||
//
|
||||
// - make a PR to the upstream registry found at ${substrateRegistryRepo}
|
||||
// - ensure the PR gets merged
|
||||
// - yarn networks:sync in this repo to sync
|
||||
//
|
||||
// Any manual changes to this file will make CI cron checks fail and will be
|
||||
// lost when the registry is updated alongside the above sync.
|
||||
//
|
||||
|
||||
import type { KnownSubstrate } from './types';
|
||||
|
||||
@@ -8,10 +8,10 @@ import fs from 'fs';
|
||||
import { stringify } from '@polkadot/util';
|
||||
import { fetch } from '@polkadot/x-fetch';
|
||||
|
||||
import { substrateRegistry } from './defaults';
|
||||
import { allNetworks } from './';
|
||||
|
||||
const OUTPUT = './.github/ss58-check.md';
|
||||
const SUBSTRATE_REGISTRY = 'https://raw.githubusercontent.com/paritytech/substrate/master/ss58-registry.json';
|
||||
|
||||
function assertAndLog (check: boolean, error: string): void {
|
||||
if (!check) {
|
||||
@@ -28,7 +28,7 @@ describe('check latest Substrate ss58 registry', (): void => {
|
||||
let original: Ss58Registry;
|
||||
|
||||
beforeAll(async (): Promise<void> => {
|
||||
original = (await (await fetch(SUBSTRATE_REGISTRY)).json()) as Ss58Registry;
|
||||
original = (await (await fetch(substrateRegistry)).json()) as Ss58Registry;
|
||||
});
|
||||
|
||||
it('has the same number as the original', (): void => {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
import type { KnownGenesis, KnownIcon, KnownLedger, KnownTestnet } from './types';
|
||||
|
||||
export const substrateRegistry = 'https://raw.githubusercontent.com/paritytech/ss58-registry/main/ss58-registry.json';
|
||||
|
||||
// NOTE: In the case where the network was hard-spooned and multiple genesisHashes
|
||||
// are provided, it needs to be in reverse order, i.e. most-recent first, oldest
|
||||
// last. This make lookups for the current a simple genesisHash[0]
|
||||
@@ -90,6 +92,8 @@ export const knownLedger: KnownLedger = {
|
||||
|
||||
// testnets should not allow selection
|
||||
export const knownTestnet: KnownTestnet = {
|
||||
'': true, // this is the default non-network entry
|
||||
'cess-testnet': true,
|
||||
'dock-testnet': true,
|
||||
jupiter: true,
|
||||
'mathchain-testnet': true,
|
||||
|
||||
@@ -18,7 +18,7 @@ export const allNetworks = knownSubstrate.map((o): SubstrateNetwork => {
|
||||
|
||||
n.genesisHash = knownGenesis[network] || [];
|
||||
n.icon = knownIcon[network] || 'substrate';
|
||||
n.isIgnored = !network || !!knownTestnet[network] || !o.standardAccount;
|
||||
n.isIgnored = !!knownTestnet[network] || (!(o.standardAccount && o.decimals && o.symbols) && o.prefix !== 42);
|
||||
|
||||
return n;
|
||||
});
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/networks', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/networks', version: '7.6.1' };
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
// Copyright 2017-2021 @polkadot/networks authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
//
|
||||
// Auto-generated by yarn networks:sync (via scripts/fromSubstrate.mjs)
|
||||
//
|
||||
// Do not edit, rather
|
||||
// - make a PR to the upstream registry as per https://raw.githubusercontent.com/paritytech/substrate/master/ss58-registry.json
|
||||
// - yarn networks:sync
|
||||
// This file should never be edited manually. Rather the process is as follow -
|
||||
//
|
||||
// - make a PR to the upstream registry found at https://github.com/paritytech/ss58-registry/
|
||||
// - ensure the PR gets merged
|
||||
// - yarn networks:sync in this repo to sync
|
||||
//
|
||||
// Any manual changes to this file will make CI cron checks fail and will be
|
||||
// lost when the registry is updated alongside the above sync.
|
||||
//
|
||||
|
||||
import type { KnownSubstrate } from './types';
|
||||
@@ -23,9 +29,9 @@ export const knownSubstrate: KnownSubstrate[] = [
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'Bare 32-bit Schnorr/Ristretto (S/R 25519) public key.',
|
||||
network: null,
|
||||
network: 'BareSr25519',
|
||||
prefix: 1,
|
||||
standardAccount: null,
|
||||
standardAccount: 'Sr25519',
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
@@ -41,9 +47,9 @@ export const knownSubstrate: KnownSubstrate[] = [
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'Bare 32-bit Ed25519 public key.',
|
||||
network: null,
|
||||
network: 'BareEd25519',
|
||||
prefix: 3,
|
||||
standardAccount: null,
|
||||
standardAccount: 'Ed25519',
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
@@ -387,14 +393,14 @@ export const knownSubstrate: KnownSubstrate[] = [
|
||||
prefix: 42,
|
||||
standardAccount: '*25519',
|
||||
symbols: null,
|
||||
website: 'https://docs.substrate.io/'
|
||||
website: 'https://substrate.io/'
|
||||
},
|
||||
{
|
||||
decimals: null,
|
||||
displayName: 'Bare 32-bit ECDSA SECP-256k1 public key.',
|
||||
network: null,
|
||||
network: 'BareSecp256k1',
|
||||
prefix: 43,
|
||||
standardAccount: null,
|
||||
standardAccount: 'secp256k1',
|
||||
symbols: null,
|
||||
website: null
|
||||
},
|
||||
@@ -623,6 +629,15 @@ export const knownSubstrate: KnownSubstrate[] = [
|
||||
symbols: ['NET'],
|
||||
website: 'https://social.network'
|
||||
},
|
||||
{
|
||||
decimals: [15],
|
||||
displayName: 'QUARTZ by UNIQUE',
|
||||
network: 'quartz_mainnet',
|
||||
prefix: 255,
|
||||
standardAccount: '*25519',
|
||||
symbols: ['QTZ'],
|
||||
website: 'https://unique.network'
|
||||
},
|
||||
{
|
||||
decimals: [18],
|
||||
displayName: 'Moonbeam',
|
||||
@@ -641,15 +656,6 @@ export const knownSubstrate: KnownSubstrate[] = [
|
||||
symbols: ['MOVR'],
|
||||
website: 'https://moonbeam.network'
|
||||
},
|
||||
{
|
||||
decimals: [18],
|
||||
displayName: 'Automata Mainnet',
|
||||
network: 'automata',
|
||||
prefix: 2349,
|
||||
standardAccount: '*25519',
|
||||
symbols: ['ATA'],
|
||||
website: 'https://ata.network'
|
||||
},
|
||||
{
|
||||
decimals: [12],
|
||||
displayName: 'Basilisk',
|
||||
@@ -659,6 +665,24 @@ export const knownSubstrate: KnownSubstrate[] = [
|
||||
symbols: ['BSX'],
|
||||
website: 'https://bsx.fi'
|
||||
},
|
||||
{
|
||||
decimals: [12],
|
||||
displayName: 'CESS Testnet',
|
||||
network: 'cess-testnet',
|
||||
prefix: 10042,
|
||||
standardAccount: '*25519',
|
||||
symbols: ['TCESS'],
|
||||
website: 'https://cess.cloud'
|
||||
},
|
||||
{
|
||||
decimals: [12],
|
||||
displayName: 'CESS',
|
||||
network: 'cess',
|
||||
prefix: 10043,
|
||||
standardAccount: '*25519',
|
||||
symbols: ['CESS'],
|
||||
website: 'https://cess.cloud'
|
||||
},
|
||||
{
|
||||
decimals: [18],
|
||||
displayName: 'Automata ContextFree',
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface KnownSubstrate {
|
||||
displayName: string;
|
||||
network: string | null;
|
||||
prefix: number;
|
||||
standardAccount: '*25519' | 'secp256k1' | null;
|
||||
standardAccount: '*25519' | 'Ed25519' | 'Sr25519' | 'secp256k1' | null;
|
||||
symbols: string[] | null;
|
||||
website: string | null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/util-crypto",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A collection of useful crypto utilities for @polkadot",
|
||||
"main": "index.js",
|
||||
@@ -22,11 +22,11 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util-crypto#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/networks": "7.5.1",
|
||||
"@polkadot/util": "7.5.1",
|
||||
"@polkadot/networks": "7.6.1",
|
||||
"@polkadot/util": "7.6.1",
|
||||
"@polkadot/wasm-crypto": "^4.2.1",
|
||||
"@polkadot/x-randomvalues": "7.5.1",
|
||||
"base-x": "^3.0.8",
|
||||
"@polkadot/x-randomvalues": "7.6.1",
|
||||
"base-x": "^3.0.9",
|
||||
"base64-js": "^1.5.1",
|
||||
"blakejs": "^1.1.1",
|
||||
"bn.js": "^4.12.0",
|
||||
@@ -47,6 +47,6 @@
|
||||
"@types/xxhashjs": "^0.2.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/util": "7.5.1"
|
||||
"@polkadot/util": "7.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { validateChars } from '../base58/validate';
|
||||
import { createValidateFn } from '../base58/validate';
|
||||
import { BASE32_ALPHABET } from './bs32';
|
||||
|
||||
const BASE_CONFIG = { alphabet: BASE32_ALPHABET, ipfsChar: 'b', type: 'base32' };
|
||||
|
||||
/**
|
||||
* @name base32Validate
|
||||
* @summary Validates a base32 value.
|
||||
* @description
|
||||
* Validates that the supplied value is valid base32
|
||||
*/
|
||||
export function base32Validate (value?: string | null, ipfsCompat?: boolean): value is string {
|
||||
return validateChars(BASE_CONFIG, value, ipfsCompat);
|
||||
}
|
||||
export const base32Validate = createValidateFn({ alphabet: BASE32_ALPHABET, ipfsChar: 'b', type: 'base32' });
|
||||
|
||||
@@ -11,17 +11,17 @@ interface CheckConfig {
|
||||
type: string;
|
||||
}
|
||||
|
||||
const BASE_CONFIG = { alphabet: BASE58_ALPHABET, ipfsChar: 'z', type: 'base58' };
|
||||
export function createValidateFn ({ alphabet, ipfsChar, type }: CheckConfig): (value?: unknown, ipfsCompat?: boolean) => value is string {
|
||||
return (value?: unknown, ipfsCompat?: boolean): value is string => {
|
||||
assert(value && typeof value === 'string', () => `Expected non-null, non-empty ${type} string input`);
|
||||
assert(!ipfsCompat || value[0] === ipfsChar, () => `Expected ${type} to start with '${ipfsChar}'`);
|
||||
|
||||
export function validateChars ({ alphabet, ipfsChar, type }: CheckConfig, value?: unknown, ipfsCompat?: boolean): true {
|
||||
assert(value && typeof value === 'string', () => `Expected non-null, non-empty ${type} string input`);
|
||||
assert(!ipfsCompat || value[0] === ipfsChar, () => `Expected ${type} to start with '${ipfsChar}'`);
|
||||
for (let i = (ipfsCompat ? 1 : 0); i < value.length; i++) {
|
||||
assert(alphabet.includes(value[i]), () => `Invalid ${type} character "${value[i]}" (0x${value.charCodeAt(i).toString(16)}) at index ${i}`);
|
||||
}
|
||||
|
||||
for (let i = (ipfsCompat ? 1 : 0); i < value.length; i++) {
|
||||
assert(alphabet.includes(value[i]), () => `Invalid ${type} character "${value[i]}" (0x${value.charCodeAt(i).toString(16)}) at index ${i}`);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,6 +30,4 @@ export function validateChars ({ alphabet, ipfsChar, type }: CheckConfig, value?
|
||||
* @description
|
||||
* Validates that the supplied value is valid base58
|
||||
*/
|
||||
export function base58Validate (value?: string | null, ipfsCompat?: boolean): value is string {
|
||||
return validateChars(BASE_CONFIG, value, ipfsCompat);
|
||||
}
|
||||
export const base58Validate = createValidateFn({ alphabet: BASE58_ALPHABET, ipfsChar: 'z', type: 'base58' });
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Keypair } from '../types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { DeriveJunction } from './DeriveJunction';
|
||||
|
||||
export function createSeedDeriveFn (fromSeed: (seed: Uint8Array) => Keypair, derive: (seed: Uint8Array, chainCode: Uint8Array) => Uint8Array): (keypair: Keypair, junction: DeriveJunction) => Keypair {
|
||||
return (keypair: Keypair, { chainCode, isHard }: DeriveJunction): Keypair => {
|
||||
assert(isHard, 'A soft key was found in the path and is not supported');
|
||||
|
||||
return fromSeed(
|
||||
derive(keypair.secretKey.subarray(0, 32), chainCode)
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -1,18 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Keypair } from '../types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { secp256k1DeriveHard } from '../secp256k1/deriveHard';
|
||||
import { secp256k1KeypairFromSeed } from '../secp256k1/keypair/fromSeed';
|
||||
import { DeriveJunction } from './DeriveJunction';
|
||||
import { createSeedDeriveFn } from './hdkdDerive';
|
||||
|
||||
export function keyHdkdEcdsa (keypair: Keypair, { chainCode, isHard }: DeriveJunction): Keypair {
|
||||
assert(isHard, 'A soft key was found in the path (and is unsupported)');
|
||||
|
||||
return secp256k1KeypairFromSeed(
|
||||
secp256k1DeriveHard(keypair.secretKey.subarray(0, 32), chainCode)
|
||||
);
|
||||
}
|
||||
export const keyHdkdEcdsa = createSeedDeriveFn(secp256k1KeypairFromSeed, secp256k1DeriveHard);
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Keypair } from '../types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { naclDeriveHard } from '../nacl/deriveHard';
|
||||
import { naclKeypairFromSeed } from '../nacl/keypair/fromSeed';
|
||||
import { DeriveJunction } from './DeriveJunction';
|
||||
import { createSeedDeriveFn } from './hdkdDerive';
|
||||
|
||||
export function keyHdkdEd25519 (keypair: Keypair, { chainCode, isHard }: DeriveJunction): Keypair {
|
||||
assert(isHard, 'A soft key was found in the path (and is unsupported)');
|
||||
|
||||
return naclKeypairFromSeed(
|
||||
naclDeriveHard(keypair.secretKey.subarray(0, 32), chainCode)
|
||||
);
|
||||
}
|
||||
export const keyHdkdEd25519 = createSeedDeriveFn(naclKeypairFromSeed, naclDeriveHard);
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/util-crypto', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/util-crypto', version: '7.6.1' };
|
||||
|
||||
@@ -5,19 +5,16 @@ import type { HexString } from '@polkadot/util/types';
|
||||
import type { Keypair } from '../types';
|
||||
|
||||
import { u8aToU8a } from '@polkadot/util';
|
||||
import { sr25519DeriveKeypairHard, sr25519DeriveKeypairSoft } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { schnorrkelKeypairFromU8a } from './keypair/fromU8a';
|
||||
import { schnorrkelKeypairToU8a } from './keypair/toU8a';
|
||||
|
||||
export function schnorrkelDerive (keypair: Keypair, chainCode: HexString | Uint8Array | string, isHard: boolean): Keypair {
|
||||
return schnorrkelKeypairFromU8a(
|
||||
(isHard
|
||||
? sr25519DeriveKeypairHard
|
||||
: sr25519DeriveKeypairSoft
|
||||
)(
|
||||
schnorrkelKeypairToU8a(keypair),
|
||||
u8aToU8a(chainCode)
|
||||
)
|
||||
);
|
||||
export function createDeriveFn (derive: (pair: Uint8Array, cc: Uint8Array) => Uint8Array): (keypair: Keypair, chainCode: HexString | Uint8Array | string) => Keypair {
|
||||
return (keypair: Keypair, chainCode: HexString | Uint8Array | string) =>
|
||||
schnorrkelKeypairFromU8a(
|
||||
derive(
|
||||
schnorrkelKeypairToU8a(keypair),
|
||||
u8aToU8a(chainCode)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Keypair } from '../types';
|
||||
import { sr25519DeriveKeypairHard } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { schnorrkelDerive } from './derive';
|
||||
import { createDeriveFn } from './derive';
|
||||
|
||||
export function schnorrkelDeriveHard (keypair: Keypair, chainCode: HexString | Uint8Array | string): Keypair {
|
||||
return schnorrkelDerive(keypair, chainCode, true);
|
||||
}
|
||||
export const schnorrkelDeriveHard = createDeriveFn(sr25519DeriveKeypairHard);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Keypair } from '../types';
|
||||
import { sr25519DeriveKeypairSoft } from '@polkadot/wasm-crypto';
|
||||
|
||||
import { schnorrkelDerive } from './derive';
|
||||
import { createDeriveFn } from './derive';
|
||||
|
||||
export function schnorrkelDeriveSoft (keypair: Keypair, chainCode: HexString | Uint8Array | string): Keypair {
|
||||
return schnorrkelDerive(keypair, chainCode, false);
|
||||
}
|
||||
export const schnorrkelDeriveSoft = createDeriveFn(sr25519DeriveKeypairSoft);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { secp256k1 } from './secp256k1';
|
||||
*/
|
||||
export function secp256k1Recover (message: Uint8Array, signature: Uint8Array, recovery: number): Uint8Array {
|
||||
return new Uint8Array(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
|
||||
secp256k1
|
||||
.recoverPubKey(message, { r: signature.slice(0, 32), s: signature.slice(32, 64) }, recovery)
|
||||
.encode(null, true)
|
||||
|
||||
@@ -21,7 +21,7 @@ export function secp256k1Verify (message: HexString | Uint8Array | string, signa
|
||||
assert(u8a.length === 65, `Expected signature with 65 bytes, ${u8a.length} found instead`);
|
||||
|
||||
const publicKey = new Uint8Array(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument
|
||||
secp256k1
|
||||
.recoverPubKey(
|
||||
secp256k1Hasher(hashType, message),
|
||||
|
||||
@@ -24,16 +24,17 @@ import xxhash64AsBn from './xxhash64/asBn';
|
||||
*/
|
||||
export function xxhashAsU8a (data: HexString | Buffer | Uint8Array | string, bitLength = 64, onlyJs = false): Uint8Array {
|
||||
const iterations = Math.ceil(bitLength / 64);
|
||||
const u8a = u8aToU8a(data);
|
||||
|
||||
if (isReady() && !onlyJs) {
|
||||
return twox(u8aToU8a(data), iterations);
|
||||
return twox(u8a, iterations);
|
||||
}
|
||||
|
||||
const u8a = new Uint8Array(Math.ceil(bitLength / 8));
|
||||
const result = new Uint8Array(Math.ceil(bitLength / 8));
|
||||
|
||||
for (let seed = 0; seed < iterations; seed++) {
|
||||
u8a.set(xxhash64AsBn(data, seed).toArray('le', 8), seed * 8);
|
||||
result.set(xxhash64AsBn(u8a, seed).toArray('le', 8), seed * 8);
|
||||
}
|
||||
|
||||
return u8a;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,11 @@
|
||||
|
||||
import xx from 'xxhashjs';
|
||||
|
||||
import { isBuffer, isString, u8aToBuffer } from '@polkadot/util';
|
||||
import { u8aToU8a } from '@polkadot/util';
|
||||
|
||||
export default function xxhash64AsValue (data: Buffer | Uint8Array | string, seed: number): number {
|
||||
if (isBuffer(data) || isString(data)) {
|
||||
return xx.h64(data, seed);
|
||||
}
|
||||
|
||||
return xx.h64(
|
||||
u8aToBuffer(data),
|
||||
u8aToU8a(data).buffer,
|
||||
seed
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
declare module 'xxhashjs' {
|
||||
export interface HashInterface {
|
||||
(data: string | Buffer, seed: number): number;
|
||||
(data: string | Buffer | ArrayBuffer, seed: number): number;
|
||||
}
|
||||
|
||||
const h64: HashInterface;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/util",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A collection of useful utilities for @polkadot",
|
||||
"main": "index.js",
|
||||
@@ -20,8 +20,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/util#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/x-textdecoder": "7.5.1",
|
||||
"@polkadot/x-textencoder": "7.5.1",
|
||||
"@polkadot/x-textdecoder": "7.6.1",
|
||||
"@polkadot/x-textencoder": "7.6.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.12.0",
|
||||
"camelcase": "^6.2.0",
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('hexHasPrefix', (): void => {
|
||||
|
||||
it('returns false when non-string value supplied', (): void => {
|
||||
expect(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument
|
||||
hexHasPrefix(false as any)
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
@@ -8,6 +8,10 @@ describe('isAscii', (): void => {
|
||||
expect(isAscii('Hello\tWorld!\n\rTesting')).toEqual(true);
|
||||
});
|
||||
|
||||
it('returns false on an non-ascii string', (): void => {
|
||||
expect(isAscii('你好,世界')).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns true for ASCII bytes', (): void => {
|
||||
expect(isAscii(new Uint8Array([0x31, 0x32, 0x20, 10]))).toEqual(true);
|
||||
});
|
||||
@@ -27,4 +31,8 @@ describe('isAscii', (): void => {
|
||||
it('returns false for non-printable characters', (): void => {
|
||||
expect(isAscii(new Uint8Array([5]))).toEqual(false);
|
||||
});
|
||||
|
||||
it('returns false for hex input, non-ascii', (): void => {
|
||||
expect(isAscii('0x010203')).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import type { U8aLike } from '../types';
|
||||
|
||||
import { u8aToU8a } from '../u8a/toU8a';
|
||||
import { isHex } from './hex';
|
||||
import { isString } from './string';
|
||||
|
||||
const FORMAT = [9, 10, 13];
|
||||
@@ -15,7 +16,12 @@ const FORMAT = [9, 10, 13];
|
||||
* Checks to see if the input string or Uint8Array is printable ASCII, 32-127 + formatters
|
||||
*/
|
||||
export function isAscii (value?: U8aLike | null): boolean {
|
||||
const isStringIn = isString(value);
|
||||
|
||||
return value
|
||||
? !u8aToU8a(value).some((byte) => (byte >= 127) || (byte < 32 && !FORMAT.includes(byte)))
|
||||
: isString(value);
|
||||
? (isStringIn && !isHex(value)
|
||||
? value.toString().split('').map((s) => s.charCodeAt(0))
|
||||
: u8aToU8a(value)
|
||||
).every((b) => (b < 127) && ((b >= 32) || FORMAT.includes(b)))
|
||||
: isStringIn;
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/util', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/util', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-bundle",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A bundler helper",
|
||||
"main": "index.js",
|
||||
@@ -17,7 +17,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-bundle#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/util": "7.5.1",
|
||||
"@polkadot/util": "7.6.1",
|
||||
"buffer-es6": "^4.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-bundle', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-bundle', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-fetch",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A cross-environment fetch replacement",
|
||||
"browser": "browser.js",
|
||||
@@ -19,7 +19,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-fetch#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/x-global": "7.5.1",
|
||||
"@polkadot/x-global": "7.6.1",
|
||||
"@types/node-fetch": "^2.5.12",
|
||||
"node-fetch": "^2.6.5"
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-fetch', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-fetch', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-global",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A cross-environment global replacement",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
|
||||
export { packageInfo } from './packageInfo';
|
||||
|
||||
type GlobalThis = typeof globalThis;
|
||||
|
||||
function evaluateThis (fn: (code: string) => unknown): GlobalThis {
|
||||
return fn('return this') as GlobalThis;
|
||||
}
|
||||
|
||||
export const xglobal = (
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
@@ -12,5 +18,5 @@ export const xglobal = (
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: this as unknown as (Window & typeof globalThis)
|
||||
: evaluateThis(Function)
|
||||
);
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-global', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-global', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-randomvalues",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A cross-environment window.crypto.getRandomValues replacement",
|
||||
"browser": "browser.js",
|
||||
@@ -19,9 +19,9 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-randomvalues#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/x-global": "7.5.1"
|
||||
"@polkadot/x-global": "7.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-native": "^0.65.7"
|
||||
"@types/react-native": "^0.66.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-randomvalues', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-randomvalues', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-textdecoder",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A TextDecoder replacement",
|
||||
"browser": "browser.js",
|
||||
@@ -19,6 +19,6 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-textdecoder#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/x-global": "7.5.1"
|
||||
"@polkadot/x-global": "7.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-textdecoder', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-textdecoder', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-textencoder",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A TextDecoder replacement",
|
||||
"browser": "browser.js",
|
||||
@@ -19,6 +19,6 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-textencoder#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/x-global": "7.5.1"
|
||||
"@polkadot/x-global": "7.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-textencoder', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-textencoder', version: '7.6.1' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/x-ws",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"type": "module",
|
||||
"description": "A cross-environment WebSocket replacement",
|
||||
"browser": "browser.js",
|
||||
@@ -19,7 +19,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/x-ws#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/x-global": "7.5.1",
|
||||
"@polkadot/x-global": "7.6.1",
|
||||
"@types/websocket": "^1.0.4",
|
||||
"websocket": "^1.0.34"
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/x-ws', version: '7.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/x-ws', version: '7.6.1' };
|
||||
|
||||
Reference in New Issue
Block a user