NAME

At::Protocol::DID - AT Protocol DID Validation

SYNOPSIS

use At::Protocol::DID qw[:all];
try {
    ensureValidDid( 'did:method:val' );
}
catch($err) {
    ...; # do something about it
}

DESCRIPTION

The AT Protocol uses Decentralized Identifiers (DIDs) as persistent, long-term account identifiers. DID is a W3C standard, with many standardized and proposed DID method implementations.

This package aims to validate them.

Functions

You may import functions by name or with the :all tag.

new( ... )

Verifies a DID and creates a new object containing it.

my $handle = At::Protocol::DID->new( 'did:web:blueskyweb.xyz' );

On success, an object is returned that will stringify to the DID itself.

ensureValidDid( ... )

ensureValidDid( 'did:plc:z72i7hdynmk6r22z27h6tvur' );

Validates a DID. Throws errors on failure and returns a true value on success.

ensureValidDidRegex( ... )

ensureValidDidRegex( 'did:method::nope' );

Validates a DID with cursory regex provided by the AT protocol designers. Throws errors on failure and returns a true value on success.

See Also

https://atproto.com/specs/did

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.

AUTHOR

Sanko Robinson <sanko@cpan.org>