Skip to content

Commit

Permalink
Merge branch 'feat/w3c-implementation' into kene-feat/w3c-implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Orjiene Kenechukwu <[email protected]>
  • Loading branch information
supersonicwisd1 authored Mar 7, 2024
2 parents a1f5415 + 69d9c58 commit bbf311e
Show file tree
Hide file tree
Showing 70 changed files with 1,939 additions and 527 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: publish-docs

on:
push:
# Publish `main` as latest, and when pushes are done to branches with "v-doc" prefix
branches:
- main
- docs-v*

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all commits/branches
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: actions/cache@v4
with:
key: ${{ github.ref }}
path: .cache
- name: Install Python dependencies
run: pip install -r ./mkdocs-requirements.txt
- name: Configure git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Deploy docs
run: |
# Strip git ref prefix from version
echo "${{ github.ref }}"
# Extract the version and if it is in `docs-v` form, strip that off the version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' -e 's/^docs-v//')
# Copy all of the root level md files into the docs folder for deployment, tweaking the relative paths
for i in *.md; do sed -e "s#docs/#./#g" $i >docs/$i; done
# Fix references in DevReadMe.md to moved files
sed -e "s#\.\./\.\./#../#" docs/features/DevReadMe.md >tmp.md; mv tmp.md docs/features/DevReadMe.md
# Populate overrides for the current version, and then remove to not apply if VERSION is main branch
OVERRIDE=overrides/main.html
echo -e "{% extends \"base.html\" %}\n\n{% block outdated %}\n You are viewing the documentation for ACA-Py Release $ALIAS.\n{% endblock %}" >$OVERRIDE
# If building from main, use latest as ALIAS and remove the override
[ "$VERSION" == "main" ] && ALIAS=latest && rm $OVERRIDE
echo $VERSION $ALIAS
mike deploy --push --update-aliases $VERSION $ALIAS
mike set-default latest
115 changes: 86 additions & 29 deletions CHANGELOG.md

Large diffs are not rendered by default.

48 changes: 21 additions & 27 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,52 +91,46 @@ Once you have the list of PRs:
- Organize the list into suitable categories, update (if necessary) the PR description and add notes to clarify the changes. See previous release entries to understand the style -- a format that should help developers.
- Add a narrative about the release above the PR that highlights what has gone into the release.

4. Update the ReadTheDocs in the `/docs` folder by following the instructions in
4. Check to see if there are any other PRs that should be included in the release.

5. Update the ReadTheDocs in the `/docs` folder by following the instructions in
the `docs/README.md` file. That will likely add a number of new and modified
files to the PR. Eliminate all of the errors in the generation process,
either by mocking external dependencies or by fixing ACA-Py code. If
necessary, create an issue with the errors and assign it to the appropriate
developer. Experience has demonstrated to use that documentation generation
errors should be fixed in the code.

5. Regenerate openapi.json and swagger.json by running
`./scripts/generate-open-api-spec`.

6. Update the version number listed in
[pyproject.toml](https://github.com/hyperledger/aries-cloudagent-python/tree/main/pyproject.toml) and, prefixed with
a "v" in [open-api/openapi.json](https://github.com/hyperledger/open-api/tree/main/openapi.json) and
[open-api/swagger.json](https://github.com/hyperledger/open-api/tree/main/swagger.json) (e.g. "0.7.2" in the
pyproject.toml file and "v0.7.2" in the openapi.json file). The incremented
version number should adhere to the [Semantic Versioning
6. Search across the repository for the previous version number and update it
everywhere that makes sense. The CHANGELOG.md is a likely exception, and the
`pyproject.toml` in the root is **MUST**. You can skip (although it won't
hurt) to update the files in the `open-api` folder as they will be
automagically updated by the next step in publishing. The incremented version
number **MUST** adhere to the [Semantic Versioning
Specification](https://semver.org/#semantic-versioning-specification-semver)
based on the changes since the last published release. For Release
Candidates, the form of the tag is "0.11.0rc2". As of release `0.11.0`
we have dropped the previously used `-` in the release candidate version
string to better follow the semver rules.

7. An extra search of the repo for the existing tag is recommended to see if
there are any other instances of the tag in the repo. If any are found to be
required (other than in CHANGELOG.md and the examples in this file, of
course), finding a way to not need them is best, but if they are needed,
please update this document to note where the tag can be found.

8. Check to see if there are any other PRs that should be included in the release.

9. Double check all of these steps above, and then submit a PR from the branch.
Candidates, the form of the tag is "0.11.0rc2". As of release `0.11.0` we
have dropped the previously used `-` in the release candidate version string
to better follow the semver rules.

7. Regenerate openapi.json and swagger.json by running
`./scripts/generate-open-api-spec`.

8. Double check all of these steps above, and then submit a PR from the branch.
Add this new PR to CHANGELOG.md so that all the PRs are included.
If there are still further changes to be merged, mark the PR as "Draft",
repeat **ALL** of the steps again, and then mark this PR as ready and then
wait until it is merged. It's embarrassing when you have to do a whole new
release just because you missed something silly...I know!

10. Immediately after it is merged, create a new GitHub tag representing the
9. Immediately after it is merged, create a new GitHub tag representing the
version. The tag name and title of the release should be the same as the
version in [pyproject.toml](https://github.com/hyperledger/aries-cloudagent-python/tree/main/pyproject.toml). Use
the "Generate Release Notes" capability to get a sequential listing of the
PRs in the release, to complement the manually curated Changelog. Verify on
PyPi that the version is published.

11. New images for the release are automatically published by the GitHubAction
10. New images for the release are automatically published by the GitHubAction
Workflows: [publish.yml] and [publish-indy.yml]. The actions are triggered
when a release is tagged, so no manual action is needed. The images are
published in the [Hyperledger Package Repository under
Expand All @@ -150,11 +144,11 @@ Once you have the list of PRs:
[publish.yml]: https://github.com/hyperledger/aries-cloudagent-python/blob/main/.github/workflows/publish.yml
[publish-indy.yml]: https://github.com/hyperledger/aries-cloudagent-python/blob/main/.github/workflows/publish-indy.yml

12. Update the ACA-Py Read The Docs site by building the new "latest" (main
11. Update the ACA-Py Read The Docs site by building the new "latest" (main
branch) and activating and building the new release. Appropriate permissions
are required to publish the new documentation version.

13. Update the [https://aca-py.org] website with the latest documentation by
12. Update the [https://aca-py.org] website with the latest documentation by
creating a PR and tag of the latest documentation from this site. Details
are provided in the [aries-acapy-docs] repository.

Expand Down
5 changes: 4 additions & 1 deletion aries_cloudagent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _matches_additional_routes(self, path: str) -> bool:
async def make_application(self) -> web.Application:
"""Get the aiohttp application instance."""

middlewares = [ready_middleware, debug_middleware, validation_middleware]
middlewares = [ready_middleware, debug_middleware]

# admin-token and admin-token are mutually exclusive and required.
# This should be enforced during parameter parsing but to be sure,
Expand Down Expand Up @@ -453,6 +453,9 @@ async def setup_context(request: web.Request, handler):

middlewares.append(setup_context)

# Register validation_middleware last avoiding unauthorized validations
middlewares.append(validation_middleware)

app = web.Application(
middlewares=middlewares,
client_max_size=(
Expand Down
10 changes: 8 additions & 2 deletions aries_cloudagent/admin/tests/test_admin_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
from ..server import AdminServer, AdminSetupError


# Ignore Marshmallow warning, as well as 'NotAppKeyWarning' coming from apispec packages
@pytest.mark.filterwarnings(
"ignore:The 'missing' attribute of fields is deprecated. Use 'load_default' instead.",
"ignore:It is recommended to use web.AppKey instances for keys.",
)
class TestAdminServer(IsolatedAsyncioTestCase):
async def asyncSetUp(self):
self.message_results = []
Expand Down Expand Up @@ -507,5 +512,6 @@ def _smaller_scope():
with pytest.raises(RuntimeError):
await responder.send_outbound(None)

with pytest.raises(RuntimeError):
await responder.send_webhook("test", {})
with pytest.deprecated_call():
with pytest.raises(RuntimeError):
await responder.send_webhook("test", {})
16 changes: 13 additions & 3 deletions aries_cloudagent/anoncreds/default/legacy_indy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ....anoncreds.default.legacy_indy.author import get_endorser_info
from ....cache.base import BaseCache
from ....config.injection_context import InjectionContext
from ....core.event_bus import EventBus
from ....core.profile import Profile
from ....ledger.base import BaseLedger
from ....ledger.error import (
Expand Down Expand Up @@ -47,6 +48,7 @@
BaseAnonCredsRegistrar,
BaseAnonCredsResolver,
)
from ...events import RevListFinishedEvent
from ...issuer import AnonCredsIssuer, AnonCredsIssuerError
from ...models.anoncreds_cred_def import (
CredDef,
Expand Down Expand Up @@ -796,8 +798,8 @@ async def _revoc_reg_entry_with_fix(
# Ledger rejected transaction request: client request invalid:
# InvalidClientRequest(...)
# In this scenario we try to post a correction
LOGGER.warn("Retry ledger update/fix due to error")
LOGGER.warn(err)
LOGGER.warning("Retry ledger update/fix due to error")
LOGGER.warning(err)
(_, _, rev_entry_res) = await self.fix_ledger_entry(
profile,
rev_list,
Expand All @@ -806,7 +808,7 @@ async def _revoc_reg_entry_with_fix(
write_ledger,
endorser_did,
)
LOGGER.warn("Ledger update/fix applied")
LOGGER.warning("Ledger update/fix applied")
elif "InvalidClientTaaAcceptanceError" in err.roll_up:
# if no write access (with "InvalidClientTaaAcceptanceError")
# e.g. aries_cloudagent.ledger.error.LedgerTransactionError:
Expand Down Expand Up @@ -966,6 +968,13 @@ async def update_revocation_list(
)

if write_ledger:
event_bus = profile.inject(EventBus)
await event_bus.notify(
profile,
RevListFinishedEvent.with_payload(
curr_list.rev_reg_def_id, newly_revoked_indices
),
)
return RevListResult(
job_id=None,
revocation_list_state=RevListState(
Expand All @@ -983,6 +992,7 @@ async def update_revocation_list(
"context": {
"job_id": job_id,
"rev_reg_def_id": rev_reg_def_id,
"rev_list": curr_list.serialize(),
"options": {
"endorser_connection_id": endorser_connection_id,
"create_transaction_for_endorser": create_transaction,
Expand Down
8 changes: 5 additions & 3 deletions aries_cloudagent/anoncreds/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def payload(self) -> RevRegDefFinishedPayload:
class RevListFinishedPayload(NamedTuple):
"""Payload of rev list finished event."""

rev_reg_def_id: str
rev_reg_id: str
revoked: list
options: dict


Expand All @@ -131,11 +132,12 @@ def __init__(self, payload: RevListFinishedPayload):
@classmethod
def with_payload(
cls,
rev_reg_def_id: str,
rev_reg_id: str,
revoked: list,
options: Optional[dict] = None,
):
"""With payload."""
payload = RevListFinishedPayload(rev_reg_def_id, options)
payload = RevListFinishedPayload(rev_reg_id, revoked, options)
return cls(payload)

@property
Expand Down
75 changes: 49 additions & 26 deletions aries_cloudagent/anoncreds/models/anoncreds_cred_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
NUM_STR_WHOLE_VALIDATE,
)

NUM_STR_WHOLE = {"validate": NUM_STR_WHOLE_VALIDATE, "example": NUM_STR_WHOLE_EXAMPLE}
NUM_STR_WHOLE = {
"validate": NUM_STR_WHOLE_VALIDATE,
"metadata": {"example": NUM_STR_WHOLE_EXAMPLE},
}


class CredDefValuePrimary(BaseModel):
Expand Down Expand Up @@ -126,17 +129,27 @@ class Meta:
model_class = CredDefValueRevocation
unknown = EXCLUDE

g = fields.Str(example="1 1F14F&ECB578F 2 095E45DDF417D")
g_dash = fields.Str(example="1 1D64716fCDC00C 1 0C781960FA66E3D3 2 095E45DDF417D")
h = fields.Str(example="1 16675DAE54BFAE8 2 095E45DD417D")
h0 = fields.Str(example="1 21E5EF9476EAF18 2 095E45DDF417D")
h1 = fields.Str(example="1 236D1D99236090 2 095E45DDF417D")
h2 = fields.Str(example="1 1C3AE8D1F1E277 2 095E45DDF417D")
htilde = fields.Str(example="1 1D8549E8C0F8 2 095E45DDF417D")
h_cap = fields.Str(example="1 1B2A32CF3167 1 2490FEBF6EE55 1 0000000000000000")
u = fields.Str(example="1 0C430AAB2B4710 1 1CB3A0932EE7E 1 0000000000000000")
pk = fields.Str(example="1 142CD5E5A7DC 1 153885BD903312 2 095E45DDF417D")
y = fields.Str(example="1 153558BD903312 2 095E45DDF417D 1 0000000000000000")
g = fields.Str(metadata={"example": "1 1F14F&ECB578F 2 095E45DDF417D"})
g_dash = fields.Str(
metadata={"example": "1 1D64716fCDC00C 1 0C781960FA66E3D3 2 095E45DDF417D"}
)
h = fields.Str(metadata={"example": "1 16675DAE54BFAE8 2 095E45DD417D"})
h0 = fields.Str(metadata={"example": "1 21E5EF9476EAF18 2 095E45DDF417D"})
h1 = fields.Str(metadata={"example": "1 236D1D99236090 2 095E45DDF417D"})
h2 = fields.Str(metadata={"example": "1 1C3AE8D1F1E277 2 095E45DDF417D"})
htilde = fields.Str(metadata={"example": "1 1D8549E8C0F8 2 095E45DDF417D"})
h_cap = fields.Str(
metadata={"example": "1 1B2A32CF3167 1 2490FEBF6EE55 1 0000000000000000"}
)
u = fields.Str(
metadata={"example": "1 0C430AAB2B4710 1 1CB3A0932EE7E 1 0000000000000000"}
)
pk = fields.Str(
metadata={"example": "1 142CD5E5A7DC 1 153885BD903312 2 095E45DDF417D"}
)
y = fields.Str(
metadata={"example": "1 153558BD903312 2 095E45DDF417D 1 0000000000000000"}
)


class CredDefValue(BaseModel):
Expand Down Expand Up @@ -178,11 +191,11 @@ class Meta:

primary = fields.Nested(
CredDefValuePrimarySchema(),
description="Primary value for credential definition",
metadata={"description": "Primary value for credential definition"},
)
revocation = fields.Nested(
CredDefValueRevocationSchema(),
description="Revocation value for credential definition",
metadata={"description": "Revocation value for credential definition"},
required=False,
)

Expand Down Expand Up @@ -243,20 +256,26 @@ class Meta:
unknown = EXCLUDE

issuer_id = fields.Str(
description="Issuer Identifier of the credential definition or schema",
metadata={
"description": "Issuer Identifier of the credential definition or schema",
"example": INDY_OR_KEY_DID_EXAMPLE,
},
data_key="issuerId",
example=INDY_OR_KEY_DID_EXAMPLE,
)
schema_id = fields.Str(
data_key="schemaId",
description="Schema identifier",
example=INDY_SCHEMA_ID_EXAMPLE,
metadata={
"description": "Schema identifier",
"example": INDY_SCHEMA_ID_EXAMPLE,
},
)
type = fields.Str(validate=OneOf(["CL"]))
tag = fields.Str(
description="""The tag value passed in by the Issuer to
metadata={
"description": """The tag value passed in by the Issuer to
an AnonCred's Credential Definition create and store implementation.""",
example="default",
"example": "default",
}
)
value = fields.Nested(CredDefValueSchema())

Expand Down Expand Up @@ -315,12 +334,14 @@ class Meta:
)
)
credential_definition_id = fields.Str(
description="credential definition id",
metadata={
"description": "credential definition id",
"example": INDY_CRED_DEF_ID_EXAMPLE,
},
allow_none=True,
example=INDY_CRED_DEF_ID_EXAMPLE,
)
credential_definition = fields.Nested(
CredDefSchema(), description="credential definition"
CredDefSchema(), metadata={"description": "credential definition"}
)


Expand Down Expand Up @@ -418,11 +439,13 @@ class Meta:
unknown = EXCLUDE

credential_definition_id = fields.Str(
description="credential definition id",
example=INDY_CRED_DEF_ID_EXAMPLE,
metadata={
"description": "credential definition id",
"example": INDY_CRED_DEF_ID_EXAMPLE,
},
)
credential_definition = fields.Nested(
CredDefSchema(), description="credential definition"
CredDefSchema(), metadata={"description": "credential definition"}
)
resolution_metadata = fields.Dict()
credential_definitions_metadata = fields.Dict()
Loading

0 comments on commit bbf311e

Please sign in to comment.