Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
KDean-Dolphin committed Jan 28, 2025
0 parents commit 7f2800b
Show file tree
Hide file tree
Showing 22 changed files with 1,252 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Push to main

on:
push:
branches:
- main

jobs:
push:
runs-on: ubuntu-latest

steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
registry-url: https://registry.npmjs.org/

- name: Checkout
uses: actions/checkout@v4

- name: Start terminal session (pre build)
if: vars.TERMINAL_PRE_BUILD == 'true'
uses: mxschmitt/action-tmate@v3

- name: Build document
shell: bash
run: |
npm install
brew install pandoc
npm run pandoc-spec
mkdir pages
mv index.html pages
- name: Start terminal session (post build)
if: vars.TERMINAL_POST_BUILD == 'true'
uses: mxschmitt/action-tmate@v3

- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Upload pages directory
uses: actions/upload-pages-artifact@v3
with:
path: pages

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
/mermaid-filter.err
/index.html
/package-lock.json
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/btcr-pandoc.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions Appendix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Appendix

### Bech32 Encoding and Decoding

**did:btc1** uses the Bech32 algorithm to encode and decode several data values. The Bech32 algorithm is documented in [BIP-0173]. Additionally, **did:btc1** uses an updated Bech32 algorithm known as "bech32m" that is documented in [BIP-0350]. For this specification we define two functions: `bech32-encode` and `bech32-decode`.

#### bech32-encode

This algorithm takes two required inputs: a string, `hrp` which is the human readable part of the encoding and a array of bytes to be encoded called the `dataPart`.

1. Initialize `result` to the output of Bech32 encoding the `hrp` and the `dataPart` as described in [BIP-0173].
2. Return `result`.

#### bech32-decode

This algorithm takes one required input: a string `bech32Str` representing a Bech32 encoding data value.

1. Initialize `hrp` and `dataPart` to the result of Bech32 decoding the `bech32Str` as described in [BIP-0173].
2. Return a tuple (`hrp`, `dataPart`)

#### Bech32 encoding a secp256k1 public key

A macro or convenience function can be used to encode a `keyBytes` representing a compressed SEC encoded secp256k1 public key. The algorithm takes one required input, `keyBytes`.

1. Initialize `hrp` to `"k"`.
2. Initialize `dataPart` to `keyBytes`.
3. Return the result of the [`bech32-encode`](#911-bech32-encode) algorithm, passing `hrp` and `dataPart`.

#### Bech32 encoding a hash-value

A macro or convenience function can be used to encode a `hashBytes` representing the sha256 hash of an initiating DID document. The algorithm takes one required input, `hashBytes`.

1. Initialize `hrp` to `"x"`.
2. Initialize `dataPart` to `hashBytes`.
3. Return the result of the [`bech32-encode`](#911-bech32-encode) algorithm, passing `hrp` and `dataPart`.


### JSON Canonicalization

A macro function that takes in a json document, `document`, and canonicalizes it following the [JSON Canonicalization Scheme](https://www.rfc-editor.org/rfc/rfc8785). The function returns the `canonicalizedBytes`.

1. Set `canonicalBytes` to the result of applying the JSON Canonicalziation Scheme to the `document`.
2. Return `canonicalBytes`.
Loading

0 comments on commit 7f2800b

Please sign in to comment.