注意: このページはまだ日本語に翻訳されていません。以下は英語の原文です。A SigningKey provides high-level access to the elliptic curve cryptography (ECC) operations and key management.
Constructors
new SigningKey()
privateKey
.
Parameters
Parameter | Type |
---|---|
privateKey | BytesLike |
Returns
SigningKey
Source
crypto/signing-key.ts:26Accessors
compressedPublicKey
0x02
or 0x03
and be 68 characters long (the 0x
prefix and 33
hexadecimal nibbles)
Returns
string
Source
crypto/signing-key.ts:54privateKey
Returns
string
Source
crypto/signing-key.ts:34publicKey
0x04
and be 132 characters long (the 0x
prefix and 130 hexadecimal
nibbles).
Returns
string
Source
crypto/signing-key.ts:44Methods
computeSharedSecret()
other
key.
The other
key may be any type of key, a raw public key, a compressed/uncompressed pubic key or aprivate key.
Best practice is usually to use a cryptographic hash on the returned value before using it as a symetric secret.
Parameters
Parameter | Type | Description |
---|---|---|
other | BytesLike | The other key to compute the shared secret with. |
Returns
string
The shared secret.
Example
Source
crypto/signing-key.ts:103sign()
digest
.
Parameters
Parameter | Type | Description |
---|---|---|
digest | BytesLike | The data to sign. |
Returns
Signature
The signature of the data.
Throws
If the digest is not 32 bytes long.Source
crypto/signing-key.ts:65addPoints()
p0
and p1
.
This is not a common function most developers should require, but can be useful for certain privacy-specific
techniques.
For example, it is used by QuaiHDWallet to compute child addresses from parent
public keys and chain codes.
Parameters
Parameter | Type | Description |
---|---|---|
p0 | BytesLike | The first point to add. |
p1 | BytesLike | The second point to add. |
compressed ? | boolean | Whether to return the compressed public key. |
Returns
string
The sum of the points.
Source
crypto/signing-key.ts:205computePublicKey()
key
, optionally compressed
.
The key
may be any type of key, a raw public key, a compressed/uncompressed public key or private key.
Parameters
Parameter | Type | Description |
---|---|---|
key | BytesLike | The key to compute the public key for. |
compressed ? | boolean | Whether to return the compressed public key. |
Returns
string
The public key.
Example
Source
crypto/signing-key.ts:135recoverPublicKey()
signature
for the given digest
.
Parameters
Parameter | Type | Description |
---|---|---|
digest | BytesLike | The data that was signed. |
signature | SignatureLike | The signature of the data. |
Returns
string
The public key.