Class: Appendix ​
Defined in: packages/method/src/utils/appendix.ts:22
Implements 9. Appendix methods.
Appendix
Constructors ​
Constructor ​
new Appendix():
Appendix
Returns ​
Appendix
Methods ​
derefernceRootCapabilityIdentifier() ​
staticderefernceRootCapabilityIdentifier(capabilityId):RootCapability
Defined in: packages/method/src/utils/appendix.ts:176
Implements 9.4.2 Dereference Root Capability Identifier.
This algorithm takes in capabilityId, a root capability identifier, and dereferences it to rootCapability, the root capability object.
Parameters ​
capabilityId ​
string
The root capability identifier to dereference.
Returns ​
The root capability object.
Example ​
for did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u SHOULD be mutated.
\{
"@context": [
"https://w3id.org/zcap/v1",
"https://w3id.org/security/data-integrity/v2",
"https://w3id.org/json-ld-patch/v1"
],
"patch": [
\{
"op": "add",
"path": "/service/4",
"value": \{
"id": "#linked-domain",
"type": "LinkedDomains",
"serviceEndpoint": "https://contact-me.com"
\}
\}
],
"proof": \{
"type": "DataIntegrityProof",
"cryptosuite": "schnorr-secp256k1-jcs-2025",
"verificationMethod": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u#initialKey",
"invocationTarget": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
"capability": "urn:zcap:root:did%3Abtcr2%3Ak1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u",
"capabilityAction": "Write",
"proofPurpose": "assertionMethod",
"proofValue": "z381yXYmxU8NudZ4HXY56DfMN6zfD8syvWcRXzT9xD9uYoQToo8QsXD7ahM3gXTzuay5WJbqTswt2BKaGWYn2hHhVFKJLXaDz"
\}
\}
***
### deriveRootCapability()
> `static` **deriveRootCapability**(`identifier`): [`RootCapability`](../interfaces/RootCapability.md)
Defined in: [packages/method/src/utils/appendix.ts:112](https://github.com/dcdpr/did-btcr2-js/blob/48f9a37f3a84dea95c74c5ee1add0d31eea187e3/packages/method/src/utils/appendix.ts#L112)
Implements [9.4.1 Derive Root Capability from did:btcr2 Identifier](https://dcdpr.github.io/did-btcr2/#derive-root-capability-from-didbtcr2-identifier).
The Derive Root Capability algorithm deterministically generates a ZCAP-LD root capability from a given did:btcr2
identifier. Each root capability is unique to the identifier. This root capability is defined and understood by the
did:btcr2 specification as the root capability to authorize updates to the specific did:btcr2 identifiers DID
document. It takes in a did:btcr2 identifier and returns a rootCapability object. It returns the root capability.
#### Parameters
##### identifier
`string`
The did-btcr2 identifier to derive the root capability from
#### Returns
[`RootCapability`](../interfaces/RootCapability.md)
The root capability object
#### Example
did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u{ "@context": "https://w3id.org/zcap/v1", "id": "urn:zcap:root:did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u", "controller": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u", "invocationTarget": "did:btcr2:k1q0rnnwf657vuu8trztlczvlmphjgc6q598h79cm6sp7c4fgqh0fkc0vzd9u" }
***
### extractDidFragment()
> `static` **extractDidFragment**(`input`): `string` \| `undefined`
Defined in: [packages/method/src/utils/appendix.ts:28](https://github.com/dcdpr/did-btcr2-js/blob/48f9a37f3a84dea95c74c5ee1add0d31eea187e3/packages/method/src/utils/appendix.ts#L28)
Extracts a DID fragment from a given input
#### Parameters
##### input
`unknown`
The input to extract the DID fragment from
#### Returns
`string` \| `undefined`
The extracted DID fragment or undefined if not found
***
### fetchFromCas()
> `static` **fetchFromCas**(`hashBytes`): `Promise`<`string` \| `undefined`>
Defined in: [packages/method/src/utils/appendix.ts:233](https://github.com/dcdpr/did-btcr2-js/blob/48f9a37f3a84dea95c74c5ee1add0d31eea187e3/packages/method/src/utils/appendix.ts#L233)
Implements [9.3. Fetch Content from Addressable Storage](https://dcdpr.github.io/did-btcr2/#fetch-content-from-addressable-storage).
The Fetch Content from Addressable Storage function takes in SHA256 hash of some content, hashBytes, converts these
bytes to a IPFS v1 Content Identifier and attempts to retrieve the identified content from Content Addressable
Storage (CAS). It returns the retrieved content or null.
#### Parameters
##### hashBytes
[`Bytes`](../../api/type-aliases/Bytes.md)
The SHA256 hash of the content to be fetched.
#### Returns
`Promise`<`string` \| `undefined`>
The fetched content or null if not found.
***
### getVerificationMethods()
> `static` **getVerificationMethods**(`didDocument`): [`DidVerificationMethod`](../../api/interfaces/DidVerificationMethod.md)[]
Defined in: [packages/method/src/utils/appendix.ts:75](https://github.com/dcdpr/did-btcr2-js/blob/48f9a37f3a84dea95c74c5ee1add0d31eea187e3/packages/method/src/utils/appendix.ts#L75)
Extracts the verification methods from a given DID Document
#### Parameters
##### didDocument
`DidDocument`
#### Returns
[`DidVerificationMethod`](../../api/interfaces/DidVerificationMethod.md)[]
An array of DidVerificationMethod objects
#### Throws
if the didDocument is not provided
***
### isDidService()
> `static` **isDidService**(`obj`): `obj is DidService`
Defined in: [packages/method/src/utils/appendix.ts:58](https://github.com/dcdpr/did-btcr2-js/blob/48f9a37f3a84dea95c74c5ee1add0d31eea187e3/packages/method/src/utils/appendix.ts#L58)
Validates that the given object is a DidService
#### Parameters
##### obj
`unknown`
The object to validate
#### Returns
`obj is DidService`
A boolean indicating whether the object is a DidService
***
### isDidVerificationMethod()
> `static` **isDidVerificationMethod**(`obj`): `obj is DidVerificationMethod`
Defined in: [packages/method/src/utils/appendix.ts:39](https://github.com/dcdpr/did-btcr2-js/blob/48f9a37f3a84dea95c74c5ee1add0d31eea187e3/packages/method/src/utils/appendix.ts#L39)
Validates that the given object is a DidVerificationMethod
#### Parameters
##### obj
`unknown`
The object to validate
#### Returns
`obj is DidVerificationMethod`
A boolean indicating whether the object is a DidVerificationMethod