How To Guides
How to set up record access rules
Each record supports attaching access rules through the access
property. This property holds a list of permissions to signers and/or JWT tokens to access it. When making api requests using the SDK those access rules can be added when building the record or changed when updating it.
import { LedgerSdk } from '@minka/ledger-sdk'
const sdk = new LedgerSdk({
server: '<your ledger URL>',
signer: {
format: 'ed25519-raw',
public: '<your ledger public key>'
}
})
const { wallet } = await sdk.wallet.init()
.data({
handle: 'test-wallet',
access: [{
action: 'read',
bearer: {
// Give permission to perform 'read' action on this wallet to requests
// with a bearer token which subject is owner@mail.com
sub: 'owner@mail.com'
}
}]
})
.hash()
.sign([{ keyPair: yourKeyPair }])
.send()
See About Authorization for more details.