# `activitypub-actor-tester`

An HTML element that renders a tool for testing an [ActivityPub][] [Actor][] using [activitypub-testing/test-actor][]

[ActivityPub]: https://www.w3.org/TR/activitypub/
[Actor]: https://www.w3.org/TR/activitypub/#actors
[activitypub-testing/test-actor]: https://www.npmjs.com/package/activitypub-testing

## Usage

Use the element in your HTML wherever you want it to appear.

```html
<activitypub-actor-tester></activitypub-actor-tester>
```

Add the custom element definition via a script tag, e.g.

```html
<script
  src="https://cdn.jsdelivr.net/npm/activitypub-actor-tester@0.3.0/dist/activitypub-actor-tester.js"
  integrity="sha384-9NHj2SNo/5NV4TqAwk3t0TUht5KjF+Kscd3H3CK6DO56s/Y1qMa1VhDPpTKcfrhd"
  type="module"
  crossorigin="anonymous"
></script>
```

### Attributes

Configure the `<activitypub-actor-tester />` element by adding [HTML Attributes](https://en.wikipedia.org/wiki/HTML_attribute).

#### actor

URL of the ActivityPub Actor that should be tested.

Default: The URL of the document the activitypub-actor-tester is contained within (i.e. `globalThis.document.location.toString()`).

Example
```html
<activitypub-actor-tester
  actor="https://socialweb.coop"
></activitypub-actor-tester>
```

#### test

When set, tests will run automatically as soon as the activitypub-actor-tester is connected to a document.
When unset, the tests are not run until the "Test..." button is clicked.

Default: unset

Example
```html
<activitypub-actor-tester
  test
></activitypub-actor-tester>
```

Note: even if the value of the `test` attribute is `false`, the tests will run, because the string `"false"` is truthy. See [Boolean attributes @lit.dev](https://lit.dev/docs/components/properties/#boolean-attributes).

## Development

### Subresource Integrity (SRI)

Integrity checksums should be the same when generated using either of the following methods.

#### Using openssl

```shell
cat dist/activitypub-actor-tester.js | openssl dgst -sha384 -binary | openssl base64 -A
```

#### Using shasum

```shell
shasum -b -a 384 dist/activitypub-actor-tester.js | awk '{ print $1 }' | xxd -r -p | base64
```
