Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
validate / validate-isniOpenRuns on Liberas

ISNI

Validates an International Standard Name Identifier (ISO 27729). input is 16 characters, or 19 as four groups of four separated by single spaces (U+0020 as the 5th, 10th and 15th characters, removed); nothing else (no hyphens, "ISNI" prefix or URL; other lengths and input over 65,536 bytes are format). The 16 must be fifteen ASCII digits then a digit, X or x, else format. checksum: ISO 7064 MOD 11-2: t = 0, then for each of the 15 digits d in order t = (t + d) × 2 mod 11; check = (12 - t) mod 11 with 10 written X; it must equal the 16th character (x read as X), else checksum. Valid gives isni (the 16 characters, X uppercase) and print (four groups of four separated by single spaces). ORCID iDs have the same structure and check character and pass when written this way.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init validate-isni --lang rust
cd validate-isni && 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)26 lines›
validate-isni.wit
package root:component;

world root {
  export liberas:validate/isni@0.1.0;
}
package liberas:validate@0.1.0 {
  interface isni {
    record isni-parts {
      isni: string,
      print: string,
    }

    enum isni-error {
      format,
      checksum,
    }

    variant isni-check {
      valid(isni-parts),
      invalid(isni-error),
    }

    check: func(input: string) -> isni-check;
  }
}
Test vectors13›
validate-isni.cases.json
[
  {
    "args": {
      "input": "0000000121032683"
    }
  },
  {
    "args": {
      "input": "0000 0001 2103 2683"
    }
  },
  {
    "args": {
      "input": "0000 0002 1825 0097"
    }
  },
  {
    "args": {
      "input": "000000012146438X"
    }
  },
  {
    "args": {
      "input": "000000012146438x"
    }
  },
  {
    "args": {
      "input": "0000000121032684"
    }
  },
  {
    "args": {
      "input": "0000 0001 2103 268"
    }
  },
  {
    "args": {
      "input": "0000-0001-2103-2683"
    }
  },
  {
    "args": {
      "input": "0000  0001 2103 2683"
    }
  },
  {
    "args": {
      "input": "00000001 2103 2683 "
    }
  },
  {
    "args": {
      "input": "000000012103268"
    }
  },
  {
    "args": {
      "input": "X000000121032683"
    }
  },
  {
    "args": {
      "input": ""
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 13 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 1,000,000 instructions.
  • Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.