const privateKey = new Ed25519PrivateKey(process.env.PRIVATE_KEY!);
const account = Account.fromPrivateKey({ privateKey });
const timestamp_ms = Date.now();
const nonce = Math.random().toString(36).slice(2);
const message = `AUTHORIZE|${timestamp_ms}|${nonce}`;
const signature = account
.sign(new TextEncoder().encode(message))
.toString();
const { token } = await ekiden.user.authorize({
public_key: account.publicKey.toString(),
timestamp_ms,
nonce,
signature,
});
ekiden.setToken(token);