1.1.1 • Published 4 years ago

swtc-keypairs v1.1.1

Weekly downloads
11
License
ISC
Repository
github
Last release
4 years ago

swtc-keypairs

An implementation of swtc keypairs & wallet generation using elliptic which supports rfc6979 and eddsa deterministic signatures.

API Methods

generateSeed({entropy?: Array<integer>, algorithm?: string}) -> string

Generate a seed that can be used to generate keypairs. Entropy can be provided as an array of bytes expressed as integers in the range 0-255. If provided, it must be at least 16 bytes long. If not provided, entropy will be automatically generated. The "algorithm" defaults to "ecdsa-secp256k1", but can also be set to "ed25519". The result is a seed encoded in base58, starting with "s".

deriveKeypair(seed: string) -> {privateKey: string, publicKey: string}

Derive a public and private key from a seed. The keys are represented as 33-byte hexadecimal strings.

sign(messageHex: string, privateKey: string) -> string

Sign an arbitrary hex-encoded message with a private key. Returns the signature as a hexadecimal string.

verify(messageHex: string, signature: string, publicKey: string) -> boolean

Verify a signature for a given hex-encoded message and public key. Returns true if the signature is valid, false otherwise.

deriveAddress(publicKey: string) -> string

Derive a Ripple address from a public key.

deriveNodeAddress(publicKey: string) -> string

Derive a node address from a public key.

Generate a random Jingtum address

const seed = generateSeed();
const keypair = deriveKeypair(seed);
const address = deriveAddress(keypair.publicKey);
1.1.1

4 years ago

1.1.0

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.3

4 years ago

0.11.21

4 years ago

0.11.20

4 years ago

0.11.19

5 years ago

0.11.18

5 years ago

0.11.17

5 years ago

0.11.16

5 years ago

0.11.15

5 years ago

0.11.14

5 years ago

0.11.13

5 years ago

0.11.12

5 years ago

0.11.11

5 years ago

0.11.10

5 years ago

0.11.9

5 years ago

0.11.8

5 years ago

0.11.7

5 years ago

0.11.6

5 years ago

0.11.5

5 years ago

0.11.4

5 years ago

0.11.3

5 years ago

0.11.2

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.10.10

5 years ago

0.10.9

5 years ago

0.10.8

5 years ago

0.10.7

5 years ago

0.10.6

5 years ago

0.10.5

5 years ago

0.10.4

5 years ago

0.10.3

5 years ago

0.10.2

5 years ago