mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-04-25 09:52:12 +00:00
Rename toB58String to getPeerId (#178)
This commit is contained in:
parent
1ca867b802
commit
7408b07ed8
@ -32,4 +32,4 @@ service Sig("sig"):
|
|||||||
verify(signature: []u8, data: []u8) -> bool
|
verify(signature: []u8, data: []u8) -> bool
|
||||||
|
|
||||||
-- Gets service's public key.
|
-- Gets service's public key.
|
||||||
get_pub_key() -> string
|
get_peer_id() -> string
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fluencelabs/fluence",
|
"name": "@fluencelabs/fluence",
|
||||||
"version": "0.23.8",
|
"version": "0.24.0",
|
||||||
"description": "TypeScript implementation of Fluence Peer",
|
"description": "TypeScript implementation of Fluence Peer",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"typings": "./dist/index.d.ts",
|
"typings": "./dist/index.d.ts",
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"@fluencelabs/avm": "0.27.0",
|
"@fluencelabs/avm": "0.27.0",
|
||||||
"@fluencelabs/connection": "workspace:0.2.0",
|
"@fluencelabs/connection": "workspace:0.2.0",
|
||||||
"@fluencelabs/interfaces": "workspace:0.1.0",
|
"@fluencelabs/interfaces": "workspace:0.1.0",
|
||||||
"@fluencelabs/keypair": "workspace:0.1.0",
|
"@fluencelabs/keypair": "workspace:0.2.0",
|
||||||
"@fluencelabs/marine-js": "0.3.9",
|
"@fluencelabs/marine-js": "0.3.9",
|
||||||
"async": "3.2.3",
|
"async": "3.2.3",
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||||
* Aqua version: 0.7.0-287
|
* Aqua version: 0.7.2-314
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { Fluence, FluencePeer } from '../../index';
|
import { Fluence, FluencePeer } from '../../index';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||||
* Aqua version: 0.7.0-285
|
* Aqua version: 0.7.2-314
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { Fluence, FluencePeer } from '../../index';
|
import { Fluence, FluencePeer } from '../../index';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||||
* Aqua version: 0.7.0-285
|
* Aqua version: 0.7.2-314
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { Fluence, FluencePeer } from '../../index';
|
import { Fluence, FluencePeer } from '../../index';
|
||||||
@ -49,7 +49,7 @@ export function registerDataProvider(...args: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SigDef {
|
export interface SigDef {
|
||||||
get_pub_key: (callParams: CallParams<null>) => string | Promise<string>;
|
get_peer_id: (callParams: CallParams<null>) => string | Promise<string>;
|
||||||
sign: (
|
sign: (
|
||||||
data: number[],
|
data: number[],
|
||||||
callParams: CallParams<'data'>,
|
callParams: CallParams<'data'>,
|
||||||
@ -73,7 +73,7 @@ export function registerSig(...args: any) {
|
|||||||
functions: {
|
functions: {
|
||||||
tag: 'labeledProduct',
|
tag: 'labeledProduct',
|
||||||
fields: {
|
fields: {
|
||||||
get_pub_key: {
|
get_peer_id: {
|
||||||
tag: 'arrow',
|
tag: 'arrow',
|
||||||
domain: {
|
domain: {
|
||||||
tag: 'nil',
|
tag: 'nil',
|
||||||
|
@ -283,7 +283,7 @@ describe('Sig service tests', () => {
|
|||||||
|
|
||||||
const res = await sig.sign(
|
const res = await sig.sign(
|
||||||
testData,
|
testData,
|
||||||
makeTetraplet((await KeyPair.randomEd25519()).toB58String(), 'registry', 'get_key_bytes'),
|
makeTetraplet((await KeyPair.randomEd25519()).getPeerId(), 'registry', 'get_key_bytes'),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(res.success).toBe(false);
|
await expect(res.success).toBe(false);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* This file is auto-generated. Do not edit manually: changes may be erased.
|
* This file is auto-generated. Do not edit manually: changes may be erased.
|
||||||
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
|
||||||
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
|
||||||
* Aqua version: 0.7.0-285
|
* Aqua version: 0.7.2-314
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { Fluence, FluencePeer } from '../../index';
|
import { Fluence, FluencePeer } from '../../index';
|
||||||
@ -12,7 +12,7 @@ import { CallParams, callFunction, registerService } from '../../internal/compil
|
|||||||
// Services
|
// Services
|
||||||
|
|
||||||
export interface SigDef {
|
export interface SigDef {
|
||||||
get_pub_key: (callParams: CallParams<null>) => string | Promise<string>;
|
get_peer_id: (callParams: CallParams<null>) => string | Promise<string>;
|
||||||
sign: (
|
sign: (
|
||||||
data: number[],
|
data: number[],
|
||||||
callParams: CallParams<'data'>,
|
callParams: CallParams<'data'>,
|
||||||
@ -36,7 +36,7 @@ export function registerSig(...args: any) {
|
|||||||
functions: {
|
functions: {
|
||||||
tag: 'labeledProduct',
|
tag: 'labeledProduct',
|
||||||
fields: {
|
fields: {
|
||||||
get_pub_key: {
|
get_peer_id: {
|
||||||
tag: 'arrow',
|
tag: 'arrow',
|
||||||
domain: {
|
domain: {
|
||||||
tag: 'nil',
|
tag: 'nil',
|
||||||
|
@ -91,8 +91,8 @@ export class Sig implements SigDef {
|
|||||||
/**
|
/**
|
||||||
* Gets the public key of KeyPair. Required by aqua
|
* Gets the public key of KeyPair. Required by aqua
|
||||||
*/
|
*/
|
||||||
get_pub_key() {
|
get_peer_id() {
|
||||||
return this._keyPair.toB58String();
|
return this._keyPair.getPeerId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,7 +126,7 @@ export class EphemeralNetwork {
|
|||||||
this._send(peer.getStatus().peerId!, nextPeerIds, particle);
|
this._send(peer.getStatus().peerId!, nextPeerIds, particle);
|
||||||
};
|
};
|
||||||
const kp = await keyPairFromBase64Sk(x.sk);
|
const kp = await keyPairFromBase64Sk(x.sk);
|
||||||
if (kp.toB58String() !== x.peerId) {
|
if (kp.getPeerId() !== x.peerId) {
|
||||||
throw new Error(`Invalid config: peer id ${x.peerId} does not match the secret key ${x.sk}`);
|
throw new Error(`Invalid config: peer id ${x.peerId} does not match the secret key ${x.sk}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@fluencelabs/keypair",
|
"name": "@fluencelabs/keypair",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"description": "Keypair implementation for Fluence JS Peer",
|
"description": "Keypair implementation for Fluence JS Peer",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"typings": "./dist/index.d.ts",
|
"typings": "./dist/index.d.ts",
|
||||||
|
@ -49,7 +49,7 @@ export class KeyPair {
|
|||||||
return new KeyPair(lib2p2Pid);
|
return new KeyPair(lib2p2Pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
toB58String(): string {
|
getPeerId(): string {
|
||||||
return this.Libp2pPeerId.toB58String();
|
return this.Libp2pPeerId.toB58String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@ -62,7 +62,7 @@ importers:
|
|||||||
'@fluencelabs/connection': workspace:0.2.0
|
'@fluencelabs/connection': workspace:0.2.0
|
||||||
'@fluencelabs/fluence-network-environment': ^1.0.13
|
'@fluencelabs/fluence-network-environment': ^1.0.13
|
||||||
'@fluencelabs/interfaces': workspace:0.1.0
|
'@fluencelabs/interfaces': workspace:0.1.0
|
||||||
'@fluencelabs/keypair': workspace:0.1.0
|
'@fluencelabs/keypair': workspace:0.2.0
|
||||||
'@fluencelabs/marine-js': 0.3.9
|
'@fluencelabs/marine-js': 0.3.9
|
||||||
'@types/bs58': ^4.0.1
|
'@types/bs58': ^4.0.1
|
||||||
'@types/jest': ^27.5.1
|
'@types/jest': ^27.5.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user