kaspeak-sdk / SecretIdentifier
Class: SecretIdentifier¶
Defined in: crypto/identifier.ts:166
SecretIdentifier
Identifier that additionally stores its private scalar.
Creation¶
fromSecret()
– wrap an existing secret (bigint / bytes / hex).random()
– generate a new cryptographically secure secret.
Extra capability¶
sign()
– produce a Schnorr signature for arbitrary data.
Public-only factories inherited from Identifier are disabled to emphasise that a SecretIdentifier must originate from a secret, not from public material.
Extends¶
Properties¶
hex¶
readonly
hex:string
Defined in: crypto/identifier.ts:30
Inherited from¶
secret¶
readonly
secret:bigint
Defined in: crypto/identifier.ts:167
Accessors¶
bytes¶
Get Signature¶
get bytes():
Uint8Array
Defined in: crypto/identifier.ts:82
Retrieves a copy of the internal byte array.
Returns¶
Uint8Array
A new Uint8Array
instance containing the bytes.
Inherited from¶
Methods¶
equals()¶
equals(
other
):boolean
Defined in: crypto/identifier.ts:97
Determines whether this identifier is equal to another by comparing their hexadecimal representations.
Parameters¶
other¶
The identifier to compare with this instance.
Returns¶
boolean
True if both identifiers have the same hexadecimal string; otherwise, false.
Inherited from¶
next()¶
next(
chainKey
,count
):Identifier
Defined in: crypto/identifier.ts:114
Jump forward count
positions in the chain:
ID_(i+count) = ID_i · chainKey^count
Parameters¶
chainKey¶
bigint
Shared chainKey
count¶
How many messages ahead (default = 1).
number
| bigint
Returns¶
Next identifier in the sequence.
Inherited from¶
prev()¶
prev(
chainKey
,count
):Identifier
Defined in: crypto/identifier.ts:129
Jump backward count
positions in the chain:
ID_(i-count) = ID_i · chainKey_inv^count
(section 4, bullet 2).
Parameters¶
chainKey¶
bigint
Shared chainKey
count¶
How many messages back (default = 1).
number
| bigint
Returns¶
Previous identifier in the sequence.
Inherited from¶
sign()¶
sign(
msg
):Promise
\<Uint8Array
\<ArrayBufferLike
>>
Defined in: crypto/identifier.ts:208
Produce Schnorr signature of msg
with the stored secret scalar.
Parameters¶
msg¶
string
| Uint8Array
\<ArrayBufferLike
>
Returns¶
Promise
\<Uint8Array
\<ArrayBufferLike
>>
verify()¶
verify(
sig
,msg
):Promise
\<boolean
>
Defined in: crypto/identifier.ts:143
Verifies the provided signature against the message using the Schnorr algorithm.
Parameters¶
sig¶
Uint8Array
The signature to verify, represented as a Uint8Array.
msg¶
The message to validate, which can be either a string or a Uint8Array.
string
| Uint8Array
\<ArrayBufferLike
>
Returns¶
Promise
\<boolean
>
A Promise that resolves to a boolean indicating whether the signature is valid.
Inherited from¶
~~fromBytes()~~¶
static
fromBytes(_
):never
Defined in: crypto/identifier.ts:193
Parameters¶
_¶
Uint8Array
Returns¶
never
Deprecated¶
not available on SecretIdentifier. Use Identifier instead.
Overrides¶
~~fromChainKey()~~¶
static
fromChainKey():never
Defined in: crypto/identifier.ts:198
Returns¶
never
Deprecated¶
not available on SecretIdentifier. Use Identifier instead.
Overrides¶
~~fromHex()~~¶
static
fromHex(_
):never
Defined in: crypto/identifier.ts:188
Parameters¶
_¶
string
Returns¶
never
Deprecated¶
not available on SecretIdentifier. Use Identifier instead.
Overrides¶
fromSecret()¶
static
fromSecret(secret
):SecretIdentifier
Defined in: crypto/identifier.ts:176
Wrap existing secret (bigint | number | bytes | hex).
Parameters¶
secret¶
string
| number
| bigint
| Uint8Array
\<ArrayBufferLike
>
Returns¶
SecretIdentifier
random()¶
static
random():SecretIdentifier
Defined in: crypto/identifier.ts:203
Generate random 32-byte secret (cryptographically secure RNG).
Returns¶
SecretIdentifier