Encryption

You choose who can read the personal data in a transfer on your side: Notabene, on your behalf, or only your own systems. That data is the IVMS-101 record of the originator and of the beneficiary, and it travels encrypted between institutions.

The options

Hosted encryption

Who can read the personal data

Notabene, on your behalf. Personal data sent to you is encrypted to the PII key Notabene holds for you, and Notabene decrypts it when you read the transfer.

End-to-end encryption

Who can read the personal data

Only your systems and the counterparty’s. You encrypt what you send and decrypt what you receive, while Notabene passes the data on without decrypting it.

OptionWho can read the personal data
Hosted encryptionNotabene, on your behalf. Personal data sent to you is encrypted to the PII key Notabene holds for you, and Notabene decrypts it when you read the transfer.
End-to-end encryptionOnly your systems and the counterparty’s. You encrypt what you send and decrypt what you receive, while Notabene passes the data on without decrypting it.

There is no setting for this in the dashboard, because the keys in your DID document decide it. Personal data sent to you is encrypted to your own PII key when your DID document has one, and to the key Notabene holds for you when it does not.

API credentials have no separate permissions, so each one has full access to your account. With hosted encryption, a system that holds one can read the personal data on your transfers through GET /api/v1/transfers/{id}?include_ivms=true. If a provider integrating on your behalf should not see that data in clear, use end-to-end encryption with your own #pii key.

End-to-end encryption

Before you send personal data, you encrypt it to the counterparty’s PII key, without signing it. Notabene adds the encryption and signature of the message itself and routes it once your policies allow. Notabene provides no encryption library, so use any standard JOSE library.

1. Find the counterparty’s key

Assess the transfer with include_pubkeys=true, and the response names the counterparty’s encryption key under beneficiaryVasp.encryptionKey, as a JSON Web Key. Without the flag, encryptionKey is null.

API reference
curl 'https://sandbox.notabene.id/api/v1/transfers/assess?include_pubkeys=true' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "asset": "ETH",
    "amount": "0.5",
    "destinationAddress": "eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
  }'const url = new URL('https://sandbox.notabene.id/api/v1/transfers/assess');
url.searchParams.set('include_pubkeys', 'true');

const response = await fetch(url, {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "asset": "ETH",
    "amount": "0.5",
    "destinationAddress": "eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
  }),
});
const answer = response.status === 204 ? null : await response.json();import requests

response = requests.post(
    'https://sandbox.notabene.id/api/v1/transfers/assess',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    params={
      "include_pubkeys": "true"
    },
    json={
      "asset": "ETH",
      "amount": "0.5",
      "destinationAddress": "eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
    },
)
answer = None if response.status_code == 204 else response.json()
What to replace
  • eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed: The destination address
Response200
{
  "travelRule": "Applies",
  "beneficiaryVasp": {
    "did": "did:web:beneficiary.example:pt",
    "encryptionKey": {
      "id": "did:web:beneficiary.example:pt#pii",
      "type": "JsonWebKey2020",
      "controller": "did:web:beneficiary.example:pt",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "QPd12KIDz9nFplcr_zn0aUHZlS5xeAxF1yBhevpPixU",
        "y": "eyqRi-hjnxxItYmZjWiHKvmJF3yMvCcz0T3lvVhZLXU"
      }
    }
  }
}
curl 'https://sandbox.notabene.id/api/v1/transfers/assess?include_pubkeys=true' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "asset": "ETH",
    "amount": "0.5",
    "destinationAddress": "eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
  }'
const url = new URL('https://sandbox.notabene.id/api/v1/transfers/assess');
url.searchParams.set('include_pubkeys', 'true');

const response = await fetch(url, {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "asset": "ETH",
    "amount": "0.5",
    "destinationAddress": "eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
  }),
});
const answer = response.status === 204 ? null : await response.json();
import requests

response = requests.post(
    'https://sandbox.notabene.id/api/v1/transfers/assess',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    params={
      "include_pubkeys": "true"
    },
    json={
      "asset": "ETH",
      "amount": "0.5",
      "destinationAddress": "eip155:1:0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
    },
)
answer = None if response.status_code == 204 else response.json()
{
  "travelRule": "Applies",
  "beneficiaryVasp": {
    "did": "did:web:beneficiary.example:pt",
    "encryptionKey": {
      "id": "did:web:beneficiary.example:pt#pii",
      "type": "JsonWebKey2020",
      "controller": "did:web:beneficiary.example:pt",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "QPd12KIDz9nFplcr_zn0aUHZlS5xeAxF1yBhevpPixU",
        "y": "eyqRi-hjnxxItYmZjWiHKvmJF3yMvCcz0T3lvVhZLXU"
      }
    }
  }
}

Keep both encryptionKey.id and encryptionKey.publicKeyJwk. When the counterparty has published its own #pii key, assess returns #pii instead of #nb-pii; otherwise it returns #notabene-pii or #nb-pii. Seal only to the key assess returns.

2. Encrypt each IVMS-101 envelope

Seal the originator’s whole IVMS-101 envelope as one JWE compact string, and the beneficiary’s as a second JWE compact string. Use v2.1’s singular originatorPerson and beneficiaryPerson keys and naturalPersonNameIdentifierType, not V1’s plural keys or nameIdentifierType.

JSONJSON
{
  "originator": {
    "originatorPerson": [
      {
        "naturalPerson": {
          "name": {
            "nameIdentifier": [
              {
                "primaryIdentifier": "Silva",
                "secondaryIdentifier": "Ana",
                "naturalPersonNameIdentifierType": "LEGL"
              }
            ]
          },
          "countryOfResidence": "PT"
        }
      }
    ]
  }
}
{
  "beneficiary": {
    "beneficiaryPerson": [
      {
        "naturalPerson": {
          "name": {
            "nameIdentifier": [
              {
                "primaryIdentifier": "Smith",
                "secondaryIdentifier": "Alice",
                "naturalPersonNameIdentifierType": "LEGL"
              }
            ]
          },
          "countryOfResidence": "PT"
        }
      }
    ]
  }
}
{
  "originator": {
    "originatorPerson": [
      {
        "naturalPerson": {
          "name": {
            "nameIdentifier": [
              {
                "primaryIdentifier": "Silva",
                "secondaryIdentifier": "Ana",
                "naturalPersonNameIdentifierType": "LEGL"
              }
            ]
          },
          "countryOfResidence": "PT"
        }
      }
    ]
  }
}
{
  "beneficiary": {
    "beneficiaryPerson": [
      {
        "naturalPerson": {
          "name": {
            "nameIdentifier": [
              {
                "primaryIdentifier": "Smith",
                "secondaryIdentifier": "Alice",
                "naturalPersonNameIdentifierType": "LEGL"
              }
            ]
          },
          "countryOfResidence": "PT"
        }
      }
    ]
  }
}

Use ECDH-ES with A256GCM, no zip, and a P-256 key, with kid set to the full encryptionKey.id from step 1. Each library below adds the ephemeral public key (epk) header automatically. Do not sign the JWE.

const { CompactEncrypt, importJWK } = await import("jose");

const publicKey = await importJWK(encryptionKey.publicKeyJwk, "ECDH-ES");
const payload = new TextEncoder().encode(JSON.stringify(originatorEnvelope));
const jwe = await new CompactEncrypt(payload)
  .setProtectedHeader({ alg: "ECDH-ES", enc: "A256GCM", kid: encryptionKey.id })
  .encrypt(publicKey);
import json
from jwcrypto import jwk, jwe

pub_fields = {k: v for k, v in encryption_key["publicKeyJwk"].items() if k in ("kty", "crv", "x", "y")}
pub = jwk.JWK(**pub_fields)
protected = {"alg": "ECDH-ES", "enc": "A256GCM", "kid": encryption_key["id"]}
token = jwe.JWE(json.dumps(originator_envelope).encode(), json.dumps(protected))
token.add_recipient(pub)
compact_jwe = token.serialize(compact=True)
use josekit::jwe::{self, JweHeader, ECDH_ES};
use josekit::jwk::Jwk;

let public_key = Jwk::from_bytes(serde_json::to_vec(&encryption_key["publicKeyJwk"])?)?;
let encrypter = ECDH_ES.encrypter_from_jwk(&public_key)?;
let mut header = JweHeader::new();

header.set_content_encryption("A256GCM");
header.set_key_id(encryption_key["id"].as_str().unwrap());
let payload = serde_json::to_vec(&originator_envelope)?;
let jwe = jwe::serialize_compact(&payload, &header, &encrypter)?;
const { CompactEncrypt, importJWK } = await import("jose");

const publicKey = await importJWK(encryptionKey.publicKeyJwk, "ECDH-ES");
const payload = new TextEncoder().encode(JSON.stringify(originatorEnvelope));
const jwe = await new CompactEncrypt(payload)
  .setProtectedHeader({ alg: "ECDH-ES", enc: "A256GCM", kid: encryptionKey.id })
  .encrypt(publicKey);
import json
from jwcrypto import jwk, jwe

pub_fields = {k: v for k, v in encryption_key["publicKeyJwk"].items() if k in ("kty", "crv", "x", "y")}
pub = jwk.JWK(**pub_fields)
protected = {"alg": "ECDH-ES", "enc": "A256GCM", "kid": encryption_key["id"]}
token = jwe.JWE(json.dumps(originator_envelope).encode(), json.dumps(protected))
token.add_recipient(pub)
compact_jwe = token.serialize(compact=True)
use josekit::jwe::{self, JweHeader, ECDH_ES};
use josekit::jwk::Jwk;

let public_key = Jwk::from_bytes(serde_json::to_vec(&encryption_key["publicKeyJwk"])?)?;
let encrypter = ECDH_ES.encrypter_from_jwk(&public_key)?;
let mut header = JweHeader::new();
header.set_content_encryption("A256GCM");
header.set_key_id(encryption_key["id"].as_str().unwrap());
let payload = serde_json::to_vec(&originator_envelope)?;
let jwe = jwe::serialize_compact(&payload, &header, &encrypter)?;

Repeat the same encryption for beneficiaryEnvelope, using the same counterparty key.

3. Send the encrypted data

Send each JWE as ivms_encrypted in place of ivms when you create the transfer. The originator and the beneficiary each take ivms or ivms_encrypted, never both.

JSON
{
  "originator_id": "urn:uuid:3c9a7e52-41f6-4b8d-a0e2-6d1f9b4c8a27",
  "originator": {
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  },
  "beneficiary_id": "urn:uuid:e7d14b39-8a2c-4f05-b6e1-2c9f7a3d5b18",
  "beneficiary": {
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..Zr8kTn2wQe5mXa9L.Pq7vRw1xYz3aBc5dEf7gHi9jKl1mNo3pQr5sTu7vWx9yZ.c4Ve8tGk2Lq6Nx0Hb"
  }
}
{
  "originator_id": "urn:uuid:3c9a7e52-41f6-4b8d-a0e2-6d1f9b4c8a27",
  "originator": {
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  },
  "beneficiary_id": "urn:uuid:e7d14b39-8a2c-4f05-b6e1-2c9f7a3d5b18",
  "beneficiary": {
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..Zr8kTn2wQe5mXa9L.Pq7vRw1xYz3aBc5dEf7gHi9jKl1mNo3pQr5sTu7vWx9yZ.c4Ve8tGk2Lq6Nx0Hb"
  }
}

The rest of the call and its response are the same as in Withdrawals.

To add encrypted data once the transfer exists, or for another recipient, call POST /api/v1/transfers/{id}/parties/{role}/encrypted-pii for originator and beneficiary. Each payload is sealed to one recipient’s key, so send it once per recipient.

API reference
curl https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80/parties/originator/encrypted-pii \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  }'const response = await fetch('https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80/parties/originator/encrypted-pii', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  }),
});
const answer = response.status === 204 ? null : await response.json();import requests

response = requests.post(
    'https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80/parties/originator/encrypted-pii',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={
      "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
    },
)
answer = None if response.status_code == 204 else response.json()
What to replace
  • 8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80: The transfer’s id
  • eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg: The IVMS-101 envelope, encrypted by you to the counterparty’s key, as a JWE compact string
Disclosed204
HTTP/1.1 204 No Content
Held202
HTTP/1.1 202 Accepted
curl https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80/parties/originator/encrypted-pii \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  }'
const response = await fetch('https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80/parties/originator/encrypted-pii', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  }),
});
const answer = response.status === 204 ? null : await response.json();
import requests

response = requests.post(
    'https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80/parties/originator/encrypted-pii',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    json={
      "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
    },
)
answer = None if response.status_code == 204 else response.json()
HTTP/1.1 204 No Content
HTTP/1.1 202 Accepted

The call answers 204 once the payload is disclosed to its recipient, or 202 while a compliance hold withholds it.

4. Publish your own PII key

To receive end-to-end encrypted personal data, generate an EC P-256 key pair and keep the private key on your own systems. Add the public key to a DID document you host yourself, as Host your DID document describes.

JSON
{
  "verificationMethod": [
    {
      "id": "did:web:example.com:pt#pii",
      "type": "JsonWebKey2020",
      "controller": "did:web:example.com:pt",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "QPd12KIDz9nFplcr_zn0aUHZlS5xeAxF1yBhevpPixU",
        "y": "eyqRi-hjnxxItYmZjWiHKvmJF3yMvCcz0T3lvVhZLXU"
      }
    }
  ],
  "keyAgreement": [
    "did:web:example.com:pt#pii",
    "did:web:example.com:pt#nb-key-agreement",
    "did:web:example.com:pt#nb-pii"
  ]
}
{
  "verificationMethod": [
    {
      "id": "did:web:example.com:pt#pii",
      "type": "JsonWebKey2020",
      "controller": "did:web:example.com:pt",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "QPd12KIDz9nFplcr_zn0aUHZlS5xeAxF1yBhevpPixU",
        "y": "eyqRi-hjnxxItYmZjWiHKvmJF3yMvCcz0T3lvVhZLXU"
      }
    }
  ],
  "keyAgreement": [
    "did:web:example.com:pt#pii",
    "did:web:example.com:pt#nb-key-agreement",
    "did:web:example.com:pt#nb-pii"
  ]
}

Give the key an id ending in #pii, list it in both verificationMethod and keyAgreement, and never publish the private key (d). Keep Notabene’s #nb-key-agreement and #nb-pii keys (or #notabene-pii if your account moved from v2) in the document.

In sandbox, Notabene publishes your DID document, so to test this there you send Notabene your document with your key added, as Host your DID document describes.

5. Read and decrypt incoming data

Read the transfer with include_ivms=true. include_ivms defaults to false, so leaving it out omits the IVMS-101 record.

API reference
curl --get https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80 \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --data-urlencode 'include_ivms=true'const url = new URL('https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80');
url.searchParams.set('include_ivms', 'true');

const response = await fetch(url, {
  method: 'GET',
  headers: {
    Authorization: 'Bearer YOUR_ACCESS_TOKEN',
  },
});
const answer = response.status === 204 ? null : await response.json();import requests

response = requests.get(
    'https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    params={
      "include_ivms": "true"
    },
)
answer = None if response.status_code == 204 else response.json()
What to replace
  • 8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80: The transfer’s id
Response200
{
  "id": "8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80",
  "status": "Active",
  "direction": "Incoming",
  "originator": {
    "id": "urn:uuid:3c9a7e52-41f6-4b8d-a0e2-6d1f9b4c8a27",
    "source": "received",
    "sent_by": "did:web:originator.example:pt",
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  },
  "beneficiary": {
    "id": "urn:uuid:e7d14b39-8a2c-4f05-b6e1-2c9f7a3d5b18",
    "source": "received",
    "sent_by": "did:web:originator.example:pt",
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..Zr8kTn2wQe5mXa9L.Pq7vRw1xYz3aBc5dEf7gHi9jKl1mNo3pQr5sTu7vWx9yZ.c4Ve8tGk2Lq6Nx0Hb"
  }
}
curl --get https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80 \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --data-urlencode 'include_ivms=true'
const url = new URL('https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80');
url.searchParams.set('include_ivms', 'true');

const response = await fetch(url, {
  method: 'GET',
  headers: {
    Authorization: 'Bearer YOUR_ACCESS_TOKEN',
  },
});
const answer = response.status === 204 ? null : await response.json();
import requests

response = requests.get(
    'https://sandbox.notabene.id/api/v1/transfers/8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80',
    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
    params={
      "include_ivms": "true"
    },
)
answer = None if response.status_code == 204 else response.json()
{
  "id": "8f3c2a1e-5b7d-4c90-a1f2-3e4d5c6b7a80",
  "status": "Active",
  "direction": "Incoming",
  "originator": {
    "id": "urn:uuid:3c9a7e52-41f6-4b8d-a0e2-6d1f9b4c8a27",
    "source": "received",
    "sent_by": "did:web:originator.example:pt",
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..q4Ib0sbsWvd7Jp1V.Hk2YzN2RmM1N2ZkNTk4ZWQyZDU1Zjk4MjQ2NmJmZQ.n3dGZtYzA2ZDlkOGE0Yg"
  },
  "beneficiary": {
    "id": "urn:uuid:e7d14b39-8a2c-4f05-b6e1-2c9f7a3d5b18",
    "source": "received",
    "sent_by": "did:web:originator.example:pt",
    "ivms_encrypted": "eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImtpZCI6ImRpZDp3ZWI6YmVuZWZpY2lhcnkuZXhhbXBsZTpwdCNwaWkifQ..Zr8kTn2wQe5mXa9L.Pq7vRw1xYz3aBc5dEf7gHi9jKl1mNo3pQr5sTu7vWx9yZ.c4Ve8tGk2Lq6Nx0Hb"
  }
}

Where the personal data is end-to-end encrypted, originator and beneficiary each hold ivms_encrypted and no plaintext ivms. Both institutions hold the transfer under the same id, and your own outgoing copy returns the ivms_encrypted strings you sent (source: "own"). Decrypt incoming JWEs with your #pii private key.

const { compactDecrypt, importJWK } = await import("jose");

const privateKey = await importJWK(privateJwk, "ECDH-ES");
const { plaintext } = await compactDecrypt(transfer.originator.ivms_encrypted, privateKey);
const originator = JSON.parse(new TextDecoder().decode(plaintext));
import json
from jwcrypto import jwk, jwe

private_key = jwk.JWK.from_json(private_jwk_json)
token = jwe.JWE()
token.deserialize(transfer["originator"]["ivms_encrypted"])
token.decrypt(private_key)
originator = json.loads(token.payload)
use josekit::jwe::{self, ECDH_ES};
use josekit::jwk::Jwk;

let private_key = Jwk::from_bytes(private_jwk_json.as_bytes())?;
let decrypter = ECDH_ES.decrypter_from_jwk(&private_key)?;
let token = transfer["originator"]["ivms_encrypted"].as_str().unwrap();
let (plaintext, _header) = jwe::deserialize_compact(token, &decrypter)?;
let originator: serde_json::Value = serde_json::from_slice(&plaintext)?;
const { compactDecrypt, importJWK } = await import("jose");

const privateKey = await importJWK(privateJwk, "ECDH-ES");
const { plaintext } = await compactDecrypt(transfer.originator.ivms_encrypted, privateKey);
const originator = JSON.parse(new TextDecoder().decode(plaintext));
import json
from jwcrypto import jwk, jwe

private_key = jwk.JWK.from_json(private_jwk_json)
token = jwe.JWE()
token.deserialize(transfer["originator"]["ivms_encrypted"])
token.decrypt(private_key)
originator = json.loads(token.payload)
use josekit::jwe::{self, ECDH_ES};
use josekit::jwk::Jwk;

let private_key = Jwk::from_bytes(private_jwk_json.as_bytes())?;
let decrypter = ECDH_ES.decrypter_from_jwk(&private_key)?;
let token = transfer["originator"]["ivms_encrypted"].as_str().unwrap();
let (plaintext, _header) = jwe::deserialize_compact(token, &decrypter)?;
let originator: serde_json::Value = serde_json::from_slice(&plaintext)?;

Common mistakes

MistakeWhat happensInstead
Sealing to another key in the counterparty’s DID documentThe counterparty does not receive the data.Seal to the encryptionKey that assess returns.
Setting kid to #pii instead of the full key idNotabene routes each blob by its kid, so a short fragment does not match the counterparty’s key.Use the full encryptionKey.id, such as did:web:beneficiary.example:pt#pii.
Using V1 IVMS-101 keys (originatorPersons, nameIdentifierType)The decrypted record is not the v2.1 IVMS-101 the recipient reads.Use singular originatorPerson and beneficiaryPerson, and naturalPersonNameIdentifierType.
Adding zip or signing the JWEThe JWE is no longer in the form recipients decrypt.Use ECDH-ES with A256GCM, leave out zip, and do not sign the JWE.
Adding #pii only to verificationMethodSenders are not handed #pii, because Notabene looks for it among the key agreement keys.List <your DID>#pii in both verificationMethod and keyAgreement, and keep #nb-key-agreement and #nb-pii.
Reading the transfer without include_ivms=trueoriginator and beneficiary come back without ivms_encrypted.Add include_ivms=true to GET/api/v1/transfers/{id}.
MistakeWhat happensInstead
Sealing to another key in the counterparty’s DID documentThe counterparty does not receive the data.Seal to the encryptionKey that assess returns.
Setting kid to #pii instead of the full key idNotabene routes each blob by its kid, so a short fragment does not match the counterparty’s key.Use the full encryptionKey.id, such as did:web:beneficiary.example:pt#pii.
Using V1 IVMS-101 keys (originatorPersons, nameIdentifierType)The decrypted record is not the v2.1 IVMS-101 the recipient reads.Use singular originatorPerson and beneficiaryPerson, and naturalPersonNameIdentifierType.
Adding zip or signing the JWEThe JWE is no longer in the form recipients decrypt.Use ECDH-ES with A256GCM, leave out zip, and do not sign the JWE.
Adding #pii only to verificationMethodSenders are not handed #pii, because Notabene looks for it among the key agreement keys.List <your DID>#pii in both verificationMethod and keyAgreement, and keep #nb-key-agreement and #nb-pii.
Reading the transfer without include_ivms=trueoriginator and beneficiary come back without ivms_encrypted.Add include_ivms=true to GET /api/v1/transfers/{id}.

Moving from v2

If you encrypt personal data yourself on v2, field by field, keep doing so until you move and add the originator’s and the beneficiary’s JWEs next to the encrypted fields, as Moving from v2 to v2.1 explains. On v2.1 you send only the JWEs.


Did this page help you?