Skip to content

Commit

Permalink
Merge branch 'hyperledger:main' into pstlouis/add-missing-verificaito…
Browse files Browse the repository at this point in the history
…n-method-option
  • Loading branch information
PatStLouis authored Apr 2, 2024
2 parents b028952 + b052b1b commit c8012e9
Show file tree
Hide file tree
Showing 163 changed files with 6,574 additions and 2,155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/blackformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: Black Code Formatter Check
# The version of black should be adjusted at the same time dev
# dependencies are updated.
uses: psf/black@24.2.0
uses: psf/black@24.3.0
11 changes: 7 additions & 4 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ jobs:
run: |
# Strip git ref prefix from version
echo "${{ github.ref }}"
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "docs-v" prefix from branch name
[[ "$VERSION" == "docs-v"* ]] && ALIAS=$(echo $VERSION | sed -e 's/^docs-v//') && VERSION=${ALIAS}
# 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
# Fix image references in demo documents so they work in GitHub and mkdocs
for i in docs/demo/AriesOpenAPIDemo.md docs/demo/AliceGetsAPhone.md; do sed -e "s#src=.collateral#src=\"../collateral#" $i >$i.tmp; mv $i.tmp $i; done
# 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
echo -e "{% extends \"base.html\" %}\n\n{% block outdated %}\n You are viewing the documentation for ACA-Py Release $VERSION.\n{% endblock %}" >$OVERRIDE
# If building from main, use latest as ALIAS and remove the override
[ "$VERSION" == "main" ] && ALIAS=latest && rm $OVERRIDE
echo $VERSION $ALIAS
Expand Down
83 changes: 49 additions & 34 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ in the [Aries ACA-Py Plugins repository]. Check them out -- it might have the ve

### Installation and Usage

Use the ["install and go" page for developers](docs/features/DevReadMe.md) if you are comfortable with Trust over IP and Aries concepts. ACA-Py can be run with Docker without installation (highly recommended), or can be installed [from PyPi](https://pypi.org/project/aries-cloudagent/). In the [/demo directory](./demo) there is a full set of demos for developers to use in getting started, and the [demo read me](docs/demo/README.md) is a great starting point for developers to use an "in-browser" approach to run a zero-install example. The [Read the Docs](https://aries-cloud-agent-python.readthedocs.io/en/latest/) overview is also a way to understand the internal modules and APIs that make up an ACA-Py instance.
Use the ["install and go" page for developers](docs/features/DevReadMe.md) if you are comfortable with Trust over IP and Aries concepts. ACA-Py can be run with Docker without installation (highly recommended), or can be installed [from PyPi](https://pypi.org/project/aries-cloudagent/). In the repository `/demo` folder there is a full set of demos for developers to use in getting up to speed quickly. Start with the [Traction Workshop] to go through a complete ACA-Py-based Issuer-Holder-Verifier flow in about 20 minutes. Next, the [Alice-Faber Demo](docs/demo/README.md) is a great way for developers try a zero-install example of how to use the ACA-Py API to operate a couple of Aries Agents. The [Read the Docs](https://aries-cloud-agent-python.readthedocs.io/en/latest/) overview is also a way to understand the internal modules and APIs that make up an ACA-Py instance.

If you would like to develop on ACA-Py locally note that we use Poetry for dependency management and packaging, if you are unfamiliar with poetry please see our [cheat sheet](docs/deploying/Poetry.md)

[Traction Workshop]: docs/demo/Aries-Workshop.md

## About the ACA-Py Admin API

The [overview of ACA-Py’s API](docs/features/AdminAPI.md) is a great starting place for learning about the ACA-Py API when you are starting to build your own controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
class TestLegacyIndyRegistry(IsolatedAsyncioTestCase):
async def asyncSetUp(self):
self.profile = InMemoryProfile.test_profile(
settings={"wallet-type": "askar-anoncreds"},
settings={"wallet.type": "askar-anoncreds"},
profile_class=AskarAnoncredsProfile,
)
self.registry = test_module.LegacyIndyRegistry()
Expand Down
3 changes: 3 additions & 0 deletions aries_cloudagent/anoncreds/error_messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Error messages for anoncreds."""

ANONCREDS_PROFILE_REQUIRED_MSG = "AnonCreds interface requires AskarAnoncreds profile"
3 changes: 2 additions & 1 deletion aries_cloudagent/anoncreds/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ..core.profile import Profile
from ..ledger.base import BaseLedger
from ..wallet.error import WalletNotFoundError
from .error_messages import ANONCREDS_PROFILE_REQUIRED_MSG
from .models.anoncreds_cred_def import CredDef

LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -72,7 +73,7 @@ def __init__(self, profile: Profile):
def profile(self) -> AskarAnoncredsProfile:
"""Accessor for the profile instance."""
if not isinstance(self._profile, AskarAnoncredsProfile):
raise ValueError("AnonCreds interface requires AskarAnoncreds")
raise ValueError(ANONCREDS_PROFILE_REQUIRED_MSG)

return self._profile

Expand Down
12 changes: 11 additions & 1 deletion aries_cloudagent/anoncreds/issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
AnonCredsSchemaAlreadyExists,
BaseAnonCredsError,
)
from .error_messages import ANONCREDS_PROFILE_REQUIRED_MSG
from .events import CredDefFinishedEvent
from .models.anoncreds_cred_def import CredDef, CredDefResult
from .models.anoncreds_schema import AnonCredsSchema, SchemaResult, SchemaState
Expand Down Expand Up @@ -97,7 +98,7 @@ def __init__(self, profile: Profile):
def profile(self) -> AskarAnoncredsProfile:
"""Accessor for the profile instance."""
if not isinstance(self._profile, AskarAnoncredsProfile):
raise ValueError("AnonCreds interface requires AskarAnoncreds")
raise ValueError(ANONCREDS_PROFILE_REQUIRED_MSG)

return self._profile

Expand Down Expand Up @@ -312,6 +313,15 @@ async def create_and_register_credential_definition(
if not isinstance(max_cred_num, int):
raise ValueError("max_cred_num must be an integer")

# Don't allow revocable cred def to be created without tails server base url
if (
not self.profile.settings.get("tails_server_base_url")
and support_revocation
):
raise AnonCredsIssuerError(
"tails_server_base_url not configured. Can't create revocable credential definition." # noqa: E501
)

anoncreds_registry = self.profile.inject(AnonCredsRegistry)
schema_result = await anoncreds_registry.get_schema(self.profile, schema_id)

Expand Down
18 changes: 9 additions & 9 deletions aries_cloudagent/anoncreds/models/anoncreds_cred_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CredDefValuePrimary(BaseModel):
class Meta:
"""PrimarySchema metadata."""

schema_class = "CredDefValuePrimarySchema"
schema_class = "CredDefValuePrimarySchemaAnoncreds"

def __init__(self, n: str, s: str, r: dict, rctxt: str, z: str, **kwargs):
"""Initialize an instance.
Expand All @@ -51,7 +51,7 @@ def __init__(self, n: str, s: str, r: dict, rctxt: str, z: str, **kwargs):
self.z = z


class CredDefValuePrimarySchema(BaseModelSchema):
class CredDefValuePrimarySchemaAnoncreds(BaseModelSchema):
"""Cred def value primary schema."""

class Meta:
Expand All @@ -73,7 +73,7 @@ class CredDefValueRevocation(BaseModel):
class Meta:
"""CredDefValueRevocation metadata."""

schema_class = "CredDefValueRevocationSchema"
schema_class = "CredDefValueRevocationSchemaAnoncreds"

def __init__(
self,
Expand Down Expand Up @@ -120,7 +120,7 @@ def __init__(
self.y = y


class CredDefValueRevocationSchema(BaseModelSchema):
class CredDefValueRevocationSchemaAnoncreds(BaseModelSchema):
"""Cred def value revocation schema."""

class Meta:
Expand Down Expand Up @@ -158,7 +158,7 @@ class CredDefValue(BaseModel):
class Meta:
"""CredDefValue metadata."""

schema_class = "CredDefValueSchema"
schema_class = "CredDefValueSchemaAnoncreds"

def __init__(
self,
Expand All @@ -180,7 +180,7 @@ def __init__(
self.revocation = revocation


class CredDefValueSchema(BaseModelSchema):
class CredDefValueSchemaAnoncreds(BaseModelSchema):
"""Cred def value schema."""

class Meta:
Expand All @@ -190,11 +190,11 @@ class Meta:
unknown = EXCLUDE

primary = fields.Nested(
CredDefValuePrimarySchema(),
CredDefValuePrimarySchemaAnoncreds(),
metadata={"description": "Primary value for credential definition"},
)
revocation = fields.Nested(
CredDefValueRevocationSchema(),
CredDefValueRevocationSchemaAnoncreds(),
metadata={"description": "Revocation value for credential definition"},
required=False,
)
Expand Down Expand Up @@ -277,7 +277,7 @@ class Meta:
"example": "default",
}
)
value = fields.Nested(CredDefValueSchema())
value = fields.Nested(CredDefValueSchemaAnoncreds())


class CredDefState(BaseModel):
Expand Down
7 changes: 5 additions & 2 deletions aries_cloudagent/anoncreds/revocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from ..core.event_bus import Event, EventBus
from ..core.profile import Profile, ProfileSession
from ..tails.base import BaseTailsServer
from .error_messages import ANONCREDS_PROFILE_REQUIRED_MSG
from .events import RevListFinishedEvent, RevRegDefFinishedEvent
from .issuer import (
CATEGORY_CRED_DEF,
Expand Down Expand Up @@ -95,7 +96,7 @@ def __init__(self, profile: Profile):
def profile(self) -> AskarAnoncredsProfile:
"""Accessor for the profile instance."""
if not isinstance(self._profile, AskarAnoncredsProfile):
raise ValueError("AnonCreds interface requires AskarAnoncreds")
raise ValueError(ANONCREDS_PROFILE_REQUIRED_MSG)

return self._profile

Expand Down Expand Up @@ -494,7 +495,9 @@ async def store_revocation_registry_list(self, result: RevListResult):

if result.revocation_list_state.state == STATE_FINISHED:
await self.notify(
RevListFinishedEvent.with_payload(rev_list.rev_reg_def_id, rev_list)
RevListFinishedEvent.with_payload(
rev_list.rev_reg_def_id, rev_list.revocation_list
)
)

except AskarError as err:
Expand Down
Loading

0 comments on commit c8012e9

Please sign in to comment.