Creates a WritableName from an existing signing key (private key).
Expects the given Uint8Array to contain a binary representation of a
private signing key. Note that this is not the same as the output of
Name.bytes, which always returns an encoding of the public key,
even when the name in question is a WritableName.
To save the key for a WritableName so that it can be used with this
function, use key.bytes, for example:
// myName.key.bytes can now be written to disk / database, etc. awaitfs.promises.writeFile('myName.key', myName.key.bytes)
// let's pretend some time has passed and we want to load the // key from disk: constloadedBytes = awaitfs.promises.readFile('myName.key') constmyName2 = awaitName.from(loadedBytes)
// myName and myName2 can now be used interchangeably }
Creates a WritableName from an existing signing key (private key).
Expects the given
Uint8Array
to contain a binary representation of a private signing key. Note that this is not the same as the output of Name.bytes, which always returns an encoding of the public key, even when the name in question is a WritableName.To save the key for a WritableName so that it can be used with this function, use
key.bytes
, for example:Example