Minka Ledger Docs
How To Guides

How to set up record access rules

DateResponsibleChanges
January 24, 2023@Luis FidelisInitial version
February 10, 2023@Omar MonterreySDK Options refactoring (url to server and key to signer)
February 27, 2023@Omar MonterreyRefactored signer.schemasigner.format
March 7, 2023@Filip HercegChanged bearer action to read
March 9, 2023@Tomislav HermanChanged ledgersdk

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.