WebOfTrust / keripy

Key Event Receipt Infrastructure - the spec and implementation of the KERI protocol
https://keripy.readthedocs.io/en/latest/
Apache License 2.0
56 stars 53 forks source link

Deprecate randomNonce() function in coring.py #739

Closed SmithSamuelM closed 4 months ago

SmithSamuelM commented 5 months ago

Nonces only need 128 bits of entropy. a Salt is enough not a seed Just use Salter().qb64.

def randomNonce():
    """ Generate a random ed25519 seed and encode as qb64

    Returns:
        str: qb64 encoded ed25519 random seed
    """
    preseed = pysodium.randombytes(pysodium.crypto_sign_SEEDBYTES)
    seedqb64 = Matter(raw=preseed, code=MtrDex.Ed25519_Seed).qb64
    return seedqb64

If truly need 256 bits of entropy for a Nonce then we should create Seeder Class that generates by default a random seed using code = MtrDex.Ed25519_Seed

lenkan commented 5 months ago

I guess we should take the same action in signify-ts: https://github.com/WebOfTrust/signify-ts/blob/development/src/keri/app/coring.ts#L13-L17 ?