Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
crypto / crypto-ed25519-publicOpenRuns on Liberas

Ed25519 public key

The Ed25519 public key of a 32-byte secret key (the seed) as RFC 8032 section 5.1.5 derives it: SHA-512 of the seed, the low 32 bytes clamped (bits 0-2 and 255 cleared, bit 254 set) as the little-endian scalar s, and the 32-byte encoding of [s]B. A secret key that is not exactly 32 bytes is an error. All byte strings are base64 in JSON.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init crypto-ed25519-public --lang rust
cd crypto-ed25519-public && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)11 lines›
crypto-ed25519-public.wit
package root:component;

world root {
  export liberas:crypto/derive-public@0.1.0;
}
package liberas:crypto@0.1.0 {
  interface derive-public {
    public-key: func(secret-key: list<u8>) -> result<list<u8>, string>;
  }
}
Test vectors11›
crypto-ed25519-public.cases.json
[
  {
    "args": {
      "secret-key": "nWGxne/9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A="
    }
  },
  {
    "args": {
      "secret-key": "TM0Imyj/ltqdtsNG7BFOD1uKMZ81q6Yk2oz27U+4pvs="
    }
  },
  {
    "args": {
      "secret-key": "xaqN9D+fg3vtt0QvMdy3sWbThTUHbwlLhc46LgtEWPc="
    }
  },
  {
    "args": {
      "secret-key": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
    }
  },
  {
    "args": {
      "secret-key": "//////////////////////////////////////////8="
    }
  },
  {
    "args": {
      "secret-key": "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8="
    }
  },
  {
    "args": {
      "secret-key": "AwoRGB8mLTQ7QklQV15lbHN6gYiPlp2kq7K5wMfO1dw="
    }
  },
  {
    "args": {
      "secret-key": "paSnpqGgo6KtrK+uqairqrW0t7axsLOyvby/vrm4u7o="
    }
  },
  {
    "args": {
      "secret-key": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ=="
    }
  },
  {
    "args": {
      "secret-key": "AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB"
    }
  },
  {
    "args": {
      "secret-key": ""
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 11 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 7,000,000 instructions.
  • Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.