doipjs/src/serviceProvider.js

63 lines
1.8 KiB
JavaScript
Raw Normal View History

2023-07-09 03:28:50 -06:00
/*
Copyright 2023 Yarmo Mackenbach
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2024-01-27 09:57:46 -07:00
2023-07-09 03:28:50 -06:00
/**
* A service provider matched to an identity claim
* @class
* @public
*/
export class ServiceProvider {
/**
2024-01-28 04:15:03 -07:00
* @param {import('./types').ServiceProviderObject} serviceProviderObject - JSON representation of a {@link ServiceProvider}
2023-07-09 03:28:50 -06:00
*/
2024-01-27 10:00:55 -07:00
constructor (serviceProviderObject) {
2023-07-09 03:28:50 -06:00
/**
* Details about the service provider
2024-01-28 04:15:03 -07:00
* @type {import('./types').ServiceProviderAbout}
2023-07-09 03:28:50 -06:00
*/
2024-01-27 10:00:55 -07:00
this.about = serviceProviderObject.about
2023-07-09 03:28:50 -06:00
/**
2024-01-27 10:00:55 -07:00
* What the profile would look like if a claim matches this service provider
2024-01-28 04:15:03 -07:00
* @type {import('./types').ServiceProviderProfile}
2023-07-09 03:28:50 -06:00
*/
2024-01-27 10:00:55 -07:00
this.profile = serviceProviderObject.profile
2023-07-09 03:28:50 -06:00
/**
2024-01-27 10:00:55 -07:00
* Information about the claim matching process
2024-01-28 04:15:03 -07:00
* @type {import('./types').ServiceProviderClaim}
2023-07-09 03:28:50 -06:00
*/
2024-01-27 10:00:55 -07:00
this.claim = serviceProviderObject.claim
2023-07-09 03:28:50 -06:00
/**
* Information for the proof verification process
2024-01-28 04:15:03 -07:00
* @type {import('./types').ServiceProviderProof}
2023-07-09 03:28:50 -06:00
*/
2024-01-27 10:00:55 -07:00
this.proof = serviceProviderObject.proof
2023-07-09 03:28:50 -06:00
}
/**
2024-01-27 10:00:55 -07:00
* Get a JSON representation of the {@link ServiceProvider}
* @function
2024-01-28 04:15:03 -07:00
* @returns {import('./types').ServiceProviderObject} JSON representation of a {@link ServiceProvider}
*/
toJSON () {
return {
about: this.about,
profile: this.profile,
claim: this.claim,
proof: this.proof
}
}
2023-07-09 03:28:50 -06:00
}