mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
feat: modify display object
This commit is contained in:
parent
34688bb644
commit
fc0af3dd1d
1 changed files with 9 additions and 6 deletions
15
src/claim.js
15
src/claim.js
|
@ -330,14 +330,16 @@ export class Claim {
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
toJSON () {
|
toJSON () {
|
||||||
let displayName = this._uri
|
let displayProfileName = this._uri
|
||||||
let displayUrl = null
|
let displayProfileUrl = null
|
||||||
|
let displayProofUrl = null
|
||||||
let displayServiceProviderName = null
|
let displayServiceProviderName = null
|
||||||
let displayServiceProviderId = null
|
let displayServiceProviderId = null
|
||||||
|
|
||||||
if (this._status >= ClaimStatus.MATCHED && this._matches.length > 0 && !this.isAmbiguous()) {
|
if (this._status >= ClaimStatus.MATCHED && this._matches.length > 0 && !this.isAmbiguous()) {
|
||||||
displayName = this._matches[0].profile.display
|
displayProfileName = this._matches[0].profile.display
|
||||||
displayUrl = this._matches[0].profile.uri
|
displayProfileUrl = this._matches[0].profile.uri
|
||||||
|
displayProofUrl = this._matches[0].proof.request.uri
|
||||||
displayServiceProviderName = this._matches[0].about.name
|
displayServiceProviderName = this._matches[0].about.name
|
||||||
displayServiceProviderId = this._matches[0].about.id
|
displayServiceProviderId = this._matches[0].about.id
|
||||||
}
|
}
|
||||||
|
@ -349,8 +351,9 @@ export class Claim {
|
||||||
matches: this._matches.map(x => x.toJSON()),
|
matches: this._matches.map(x => x.toJSON()),
|
||||||
status: this._status,
|
status: this._status,
|
||||||
display: {
|
display: {
|
||||||
name: displayName,
|
profileName: displayProfileName,
|
||||||
url: displayUrl,
|
profileUrl: displayProfileUrl,
|
||||||
|
proofUrl: displayProofUrl,
|
||||||
serviceProviderName: displayServiceProviderName,
|
serviceProviderName: displayServiceProviderName,
|
||||||
serviceProviderId: displayServiceProviderId
|
serviceProviderId: displayServiceProviderId
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue