···11111212## How it works
13131414-The core data fields associated with an active `did:plc` identifier at any point in time are listed below. The encoding and structure differs somewhat from DID document formatting and semantics, but this information is sufficient to render a valid DID document.
1414+The metadata associated with an active `did:plc` identifier at any point in time is listed below. The encoding and structure differs somewhat from DID document formatting and semantics, but this information is sufficient to render a valid DID document.
15151616- `did` (string): the full DID identifier
1717- `rotationKeys` (array of strings): priority-ordered list of public keys in `did:key` encoding. must include least 1 key and at most 5 keys, with no duplication. control of the DID identifier rests in these keys. not included in DID document.
···148148149149To summarize the process of creating a new `did:plc` identifier:
150150151151-- collect values for all of the core data fields, including generating new secure key pairs if necessary
151151+- collect values for the essential operation data fields, including generating new secure key pairs if necessary
152152- construct an "unsigned" regular operation object. include a `prev` field with `null` value. do not use the deprecated/legacy operation format for new DID creations
153153- serialize the "unsigned" operation with DAG-CBOR, and sign the resulting bytes with one of the initial `rotationKeys`. encode the signature as `base64url`, and use that to construct a "signed" operation object
154154- serialize the "signed" operation with DAG-CBOR, take the SHA-256 hash of those bytes, and encode the hash bytes in `base32`. use the first 24 characters to generate DID value (`did:plc:<hashchars>`)
···163163164164- if the current DID state isn't known, fetch the current state from `https://plc.directory/:did/data`
165165- if the most recent valid DID operation CID (hash) isn't known, fetch the audit log from `https://plc.directory/:did/log/audit`, identify the most recent valid operation, and get the `cid` value. if this is a recovery operation, the relevant "valid" operation to fork from may not be the most recent in the audit log
166166-- collect updated values for all of the core data fields, including generating new secure key pairs if necessary (eg, key rotation)
166166+- collect updated values for the essential operation data fields, including generating new secure key pairs if necessary (eg, key rotation)
167167- construct an "unsigned" regular operation object. include a `prev` field with the CID (hash) of the previous valid operation
168168- serialize the "unsigned" operation with DAG-CBOR, and sign the resulting bytes with one of the previously-existing `rotationKeys`. encode the signature as `base64url`, and use that to construct a "signed" operation object
169169- serialize the "signed" operation as simple JSON, and submit it via HTTP POST to `https://plc.directory/:did`