Skip to content

Commit

Permalink
[mdast] key rotation example
Browse files Browse the repository at this point in the history
  • Loading branch information
hariria committed Sep 5, 2024
1 parent f60c10b commit 2a422c0
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<a id="0x1_account_KeyRotation"></a>

## Struct `KeyRotation`

```move
#[event]
struct KeyRotation has drop, store
```

<details>
<summary>Fields</summary>

<dl>
<dt>
<code><a href="account.md#0x1_account">account</a>: <b>address</b></code>
</dt>
<dd>

</dd>
<dt>
<code>old_authentication_key: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>new_authentication_key: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
</dt>
<dd>

</dd>
</dl>

</details>

<a id="0x1_account_Account"></a>

## Resource `Account`

Resource representing an account.

```move
struct Account has store, key
```

<details>
<summary>Fields</summary>

<dl>
<dt>
<code>authentication_key: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>sequence_number: u64</code>
</dt>
<dd>

</dd>
<dt>
<code>guid_creation_num: u64</code>
</dt>
<dd>

</dd>
<dt>
<code>coin_register_events: <a href="event.md#0x1_event_EventHandle">event::EventHandle</a>&lt;<a href="account.md#0x1_account_CoinRegisterEvent">account::CoinRegisterEvent</a>&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>key_rotation_events: <a href="event.md#0x1_event_EventHandle">event::EventHandle</a>&lt;<a href="account.md#0x1_account_KeyRotationEvent">account::KeyRotationEvent</a>&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>rotation_capability_offer: <a href="account.md#0x1_account_CapabilityOffer">account::CapabilityOffer</a>&lt;<a href="account.md#0x1_account_RotationCapability">account::RotationCapability</a>&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>signer_capability_offer: <a href="account.md#0x1_account_CapabilityOffer">account::CapabilityOffer</a>&lt;<a href="account.md#0x1_account_SignerCapability">account::SignerCapability</a>&gt;</code>
</dt>
<dd>

</dd>
</dl>

</details>
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { expect, test } from 'vitest'
import { astToMarkdown, convertHtmlToMarkdownCodeBlocks, readFileAsTree } from './mdast'

test('mdast readFileAsTree from local markdown', () => {
const tree = readFileAsTree();
console.log("Tree pre-treatment: ", tree);
test('keyRotation parse and fix AST', () => {
const tree = readFileAsTree("./examples/keyRotation.md");
convertHtmlToMarkdownCodeBlocks(tree);
console.log("Tree post-codeblock treatment: ", tree);
const markdown = astToMarkdown(tree);
console.log(markdown)
console.log(markdown);
expect(markdown).toEqual(astToMarkdown(readFileAsTree('./examples/keyRotation.expect.md')).toString())
})

0 comments on commit 2a422c0

Please sign in to comment.