Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
969918f
start refactoring creds behaviour for address
paulo-ocean Feb 26, 2025
2d638fd
more refactor
paulo-ocean Feb 26, 2025
2c23a9b
change default behaviour
paulo-ocean Feb 27, 2025
e9f98d5
change default behaviour, add unti test
paulo-ocean Feb 27, 2025
97f56a0
fix unit test
paulo-ocean Feb 27, 2025
8631883
fix unit test
paulo-ocean Feb 27, 2025
3836ce3
fix unit test
paulo-ocean Feb 27, 2025
e9db2c4
fix unit test
paulo-ocean Feb 27, 2025
56e7953
update asset credentials
paulo-ocean Feb 27, 2025
ae79d68
try debug it
paulo-ocean Feb 28, 2025
edbdd12
fix service levels credentials on asset
paulo-ocean Feb 28, 2025
af5b509
clean debug console.log
paulo-ocean Feb 28, 2025
02bfa35
Merge branch 'main' into issue-810-creds-address-behaviour
paulo-ocean Mar 7, 2025
a4498fc
add new types and match all/any rules
paulo-ocean Mar 7, 2025
01e249a
add new types and match all/any rules
paulo-ocean Mar 7, 2025
ed62637
extend check to match rules any or all
paulo-ocean Mar 10, 2025
c808dde
Merge branch 'main' into issue-810-creds-address-behaviour
paulo-ocean Mar 11, 2025
f1b87b6
add support for accessList on download checkCredentials
paulo-ocean Mar 11, 2025
329fb95
fix tests, async call
paulo-ocean Mar 11, 2025
d8972e0
Merge branch 'main' into issue-810-creds-address-behaviour
paulo-ocean Mar 11, 2025
263bf4a
Merge branch 'main' into issue-810-creds-address-behaviour
paulo-ocean Mar 14, 2025
4136d96
Merge pull request #873 from oceanprotocol/issue-871-checkCredentials…
paulo-ocean Mar 17, 2025
aaeb4d4
Merge branch 'main' into issue-810-creds-address-behaviour
giurgiur99 Apr 22, 2025
b9b5d77
use latest ddo-js
giurgiur99 Apr 23, 2025
0de2b5c
refactor match credentials
giurgiur99 Apr 23, 2025
fcf6830
Merge branch 'main' into issue-810-creds-address-behaviour
giurgiur99 Apr 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 39 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"@libp2p/upnp-nat": "^1.2.1",
"@libp2p/websockets": "^8.1.1",
"@multiformats/multiaddr": "^10.2.0",
"@oceanprotocol/ddo-js": "^0.0.8",
"@oceanprotocol/contracts": "^2.3.0",
"@oceanprotocol/ddo-js": "^0.0.6",
"@types/lodash.clonedeep": "^4.5.7",
"axios": "^1.8.4",
"base58-js": "^2.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/@types/DDO/Credentials.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/core/handler/downloadHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class DownloadHandler extends CommandHandler {
).success
} else {
accessGrantedDDOLevel = areKnownCredentialTypes(ddo.credentials)
? checkCredentials(ddo.credentials, task.consumerAddress)
? await checkCredentials(ddo.credentials, task.consumerAddress, ddo.chainId)
: true
}
if (!accessGrantedDDOLevel) {
Expand Down Expand Up @@ -396,7 +396,7 @@ export class DownloadHandler extends CommandHandler {
).success)
} else {
accessGrantedServiceLevel = areKnownCredentialTypes(service.credentials)
? checkCredentials(service.credentials, task.consumerAddress)
? await checkCredentials(service.credentials, task.consumerAddress, chainId)
: true
}

Expand Down
25 changes: 18 additions & 7 deletions src/test/data/assets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Credentials } from '@oceanprotocol/ddo-js'
import { Credentials, CREDENTIALS_TYPES } from '@oceanprotocol/ddo-js'

export const downloadAsset = {
'@context': ['https://w3id.org/did/v1'],
Expand Down Expand Up @@ -62,29 +62,40 @@ export const downloadAsset = {
const nftLevelCredentials: Credentials = {
allow: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e']
},
{
type: 'address',
values: ['0xA78deb2Fa79463945C247991075E2a0e98Ba7A09']
type: CREDENTIALS_TYPES.ADDRESS,
values: [
'0xA78deb2Fa79463945C247991075E2a0e98Ba7A09',
'0xe2DD09d719Da89e5a3D0F2549c7E24566e947260'
]
}
],
deny: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0x02354A1F160A3fd7ac8b02ee91F04104440B28E7']
}
]
}

const serviceLevelCredentials: Credentials = {
allow: [],
deny: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0xA78deb2Fa79463945C247991075E2a0e98Ba7A09']
}
],
allow: [
{
type: CREDENTIALS_TYPES.ADDRESS,
values: [
'0xe2DD09d719Da89e5a3D0F2549c7E24566e947260',
'0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e'
]
}
]
}

Expand Down
18 changes: 10 additions & 8 deletions src/test/data/ddo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CREDENTIALS_TYPES } from '@oceanprotocol/ddo-js'

export const ddo = {
hashType: 'sha256',
'@context': ['https://w3id.org/did/v1'],
Expand Down Expand Up @@ -71,13 +73,13 @@ export const genericAlgorithm = {
credentials: {
allow: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e']
}
],
deny: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0x123']
}
]
Expand Down Expand Up @@ -124,13 +126,13 @@ export const genericDDO = {
credentials: {
allow: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e']
}
],
deny: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0x123']
}
]
Expand Down Expand Up @@ -189,13 +191,13 @@ export const genericComputeDDO = {
credentials: {
allow: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0xBE5449a6A97aD46c8558A3356267Ee5D2731ab5e']
}
],
deny: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0x123']
}
]
Expand Down Expand Up @@ -348,13 +350,13 @@ export const ddov7 = {
credentials: {
allow: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0x1234']
}
],
deny: [
{
type: 'address',
type: CREDENTIALS_TYPES.ADDRESS,
values: ['0xabcd']
}
]
Expand Down
Loading
Loading