Class: VerificationMethod
identity_wasm.VerificationMethod
A DID Document Verification Method.
Table of contents
Constructors
Methods
- toJSON
- toString
- newFromJwk
- id
- setId
- controller
- setController
- type
- setType
- data
- setData
- properties
- setPropertyUnchecked
- fromJSON
- clone
Constructors
constructor
• new VerificationMethod(id
, controller
, type_
, data
)
Create a custom VerificationMethod.
Parameters
Name | Type |
---|---|
id | DIDUrl |
controller | CoreDID |
type_ | MethodType |
data | MethodData |
Methods
toJSON
▸ toJSON(): Object
- Return copy of self without private attributes.
Returns
Object
▸ toJSON(): any
Serializes this to a JSON object.
Returns
any
toString
▸ toString(): string
Return stringified version of self.
Returns
string
newFromJwk
▸ Static
newFromJwk(did
, key
, fragment?
): VerificationMethod
Creates a new VerificationMethod from the given did
and Jwk. If fragment
is not given
the kid
value of the given key
will be used, if present, otherwise an error is returned.
Recommendations
The following recommendations are essentially taken from the publicKeyJwk
description from the DID specification:
- It is recommended that verification methods that use
Jwks
to represent their public keys use the value ofkid
as their fragment identifier. This is done automatically ifNone
is passed in as the fragment. - It is recommended that Jwk kid values are set to the public key fingerprint.
Parameters
Name | Type |
---|---|
did | IToCoreDID | CoreDID |
key | Jwk |
fragment? | string |
Returns
id
▸ id(): DIDUrl
Returns a copy of the DIDUrl of the VerificationMethod's id
.
Returns
setId
▸ setId(id
): void
Sets the id of the VerificationMethod.
Parameters
Name | Type |
---|---|
id | DIDUrl |
Returns
void
controller
▸ controller(): CoreDID
Returns a copy of the controller
DID
of the VerificationMethod.
Returns
setController
▸ setController(did
): void
Sets the controller
DID
of the VerificationMethod object.
Parameters
Name | Type |
---|---|
did | CoreDID |
Returns
void
type
▸ type(): MethodType
Returns a copy of the VerificationMethod type.
Returns
setType
▸ setType(type_
): void
Sets the VerificationMethod type.
Parameters
Name | Type |
---|---|
type_ | MethodType |
Returns
void
data
▸ data(): MethodData
Returns a copy of the VerificationMethod public key data.
Returns
setData
▸ setData(data
): void
Sets VerificationMethod public key data.
Parameters
Name | Type |
---|---|
data | MethodData |
Returns
void
properties
▸ properties(): Map
\<string
, any
>
Get custom properties of the Verification Method.
Returns
Map
\<string
, any
>
setPropertyUnchecked
▸ setPropertyUnchecked(key
, value
): void
Adds a custom property to the Verification Method.
If the value is set to null
, the custom property will be removed.
WARNING
This method can overwrite existing properties like id
and result
in an invalid Verification Method.
Parameters
Name | Type |
---|---|
key | string |
value | any |
Returns
void
fromJSON
▸ Static
fromJSON(json
): VerificationMethod
Deserializes an instance from a JSON object.
Parameters
Name | Type |
---|---|
json | any |
Returns
clone
▸ clone(): VerificationMethod
Deep clones the object.